[PATCH 2/4] iio: magnetometer: ak8975: replace usleep_range() with fsleep()

Joshua Crofts
2026-04-20T11:09:09Z

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@gmail.com>
---
drivers/iio/magnetometer/ak8975.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index f45dca0a6f0..d4ba96a5630 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -461,7 +461,7 @@ static int ak8975_power_on(const struct ak8975_data *data)
* and the minimum wait time before mode setting is 100us, in
* total 300us. Add some margin and say minimum 500us here.
*/
- usleep_range(500, 1000);
+ fsleep(500);
return 0;
}

@@ -551,7 +551,7 @@ static int ak8975_set_mode(struct ak8975_data *data, enum ak_ctrl_mode mode)

data->cntl_cache = regval;
/* After mode change wait at least 100us */
- usleep_range(100, 500);
+ fsleep(100);

return 0;
}
--
2.47.3