Re: [PATCH v5 03/18] iio: magnetometer: ak8975: replace usleep_range() with fsleep()
From: Maxwell Doose
Date: Tue May 05 2026 - 16:32:14 EST
Hi Joshua,
On Tue, May 5, 2026 at 6:53 AM Joshua Crofts via B4 Relay
<devnull+joshua.crofts1.gmail.com@xxxxxxxxxx> wrote:
>
> From: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
>
> Replace usleep_range() calls with fsleep(), passing the minimum value
> required by the sensor for hardware delays.
>
> fsleep() automatically selects the optimal sleep mechanism, simplifying
> driver code and time management.
>
> Signed-off-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
> ---
> drivers/iio/magnetometer/ak8975.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
[snip]
Looks fine overall but has this been tested on actual hardware? Just
want to double check since this touches the set_mode and power_on
logic. Also I will say it may be better to keep usleep_range() since
it's more explicit, which will likely be better for the future to make
it obvious. Also, I was taking a look at the docs for fsleep() and it
provides "maximum 25% slack", which means we're stripping away almost
375us on one of these calls. And besides, it would eventually just
call usleep_range() anyways.
best regards,
max