Re: [PATCH v5 4/7] rust: time: add Delta::to_jiffies() for timeout conversion

FUJITA Tomonori <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Thu, 06 Aug 2026 11:50:35 +0200
Andreas Hindborg <[email protected]> wrote:

>> diff --git a/rust/kernel/time.rs b/rust/kernel/time.rs
>> index 9d65a6c1992a..5844ee985a7b 100644
>> --- a/rust/kernel/time.rs
>> +++ b/rust/kernel/time.rs
>> @@ -551,6 +551,27 @@ pub fn as_millis_ceil(self) -> i64 {
>>          }
>>      }
>>  
>> +    /// Convert this span to a [`Delta<Jiffy>`] suitable for use as a timeout.
>> +    ///
>> +    /// The value is rounded up to the next whole jiffy, so the resulting
>> +    /// timeout is never shorter than `self` (as `msecs_to_jiffies()` does).
>> +    /// A negative span clamps to zero jiffies (an immediate timeout).
> 
> Should we rename this to `to_jiffies_timeout` to indicate the clamping
> logic more clearly? I would expect a function with this name to have a
> negative `Delta<Nsec>` convert to a negative `Delta<Jiffy>`.

Make sense. I'll rename it.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.