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

FUJITA Tomonori
2025-07-28T12:52:24Z

On Mon, 28 Jul 2025 09:44:39 -0300
Daniel Almeida <daniel.almeida@collabora.com> wrote:

>> Add read_poll_timeout functions which poll periodically until a
>> condition is met or a timeout is reached.
>>
>> The C's read_poll_timeout (include/linux/iopoll.h) is a complicated
>> macro and a simple wrapper for Rust doesn't work. So this implements
>> the same functionality in Rust.
>>
>> The C version uses usleep_range() while the Rust version uses
>> fsleep(), which uses the best sleep method so it works with spans that
>> usleep_range() doesn't work nicely with.
>>
>> The sleep_before_read argument isn't supported since there is no user
>> for now. It's rarely used in the C version.
>>
>> read_poll_timeout() can only be used in a nonatomic context. This
>> requirement is not checked by these abstractions, but it is intended
>> that klint [1] or a similar tool will be used to check it in the
>> future.
>>
>> Link: https://rust-for-linux.com/klint [1]
>> Tested-by: Daniel Almeida <daniel.almeida@collabora.com>
>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
>
> This appears to be the last version of this patch. Do you have any plans to
> keep working on it? Is there anything I can do to help? :)
>
> If you don’t have the time to work on this, I can pick it up for you.

All the dependencies for this patch (timer, fsleep, might_sleep, etc)
are planned to be merged in 6.17-rc1, and I'll submit the updated
version after the rc1 release.