Subject: Re: [PATCH v11 7/8] rust: Add read_poll_timeout functions

From: "Danilo Krummrich" <[email-masked]>
Date: Mon, 28 Jul 2025 16:30:09 +0200

On Mon Jul 28, 2025 at 4:13 PM CEST, Daniel Almeida wrote:
> Tyr needs read_poll_timeout_atomic() too, but I never really understood
> if that's not achievable by setting sleep_delta==0, which skips the
> call to fsleep().

read_poll_timeout_atomic() uses udelay() instead of fsleep(), where the latter
may sleep.

In [1] I explicitly asked for not having the

	if sleep_delta != 0 {
	   might_sleep();
	}

conditional.

It hides bugs and callers should be explicit about what they want. Either they
want something that actually may sleep or they want something that can be used
from atomic context.

Even better, in Rust we can use Klint to validate correct usage at compile time
with this separation.

[1] https://lore.kernel.org/lkml/[email-masked]/