Re: [PATCH v2 5/7] iio: pressure: dps310: use time unit macros for sleeps and timeouts
From: Joshua Crofts
Date: Thu Nov 26 2026 - 09:19:18 EST
On 26-Nov-26 14:49, Andy Shevchenko wrote:
> On Thu, Nov 26, 2026 at 02:17:34PM +0100, Joshua Crofts wrote:
>> On 26-Nov-26 13:13, Rupesh Majhi wrote:
>
> ...
>
>> > - usleep_range(15000, 55000);
>> > + msleep(20);
>> I think it's safe to use 15 as specified in the datasheet, as msleep()
>> guarantees sleep for the specified time + a max of 12.5% slack.
>
> Wouldn't be better to have some margin still? You know that time goes
> differently on different CPUs and in general time can go backwards (in
> computers), so the long sleeps can (I haven't checked though) go both ways,
> and a minimum sleeping time can be less. Also on the other side firmware
> might have issues in some circumstances and require slightly bigger sleep
> than specified. That's why I proposed margin.
Sure, it's just that some patches add a margin and some patches ignore this
and just add the default datasheet value. A lot of times slack is an adequate
enough margin. I was always for just the default value.
--
Kind regards,
Joshua Crofts