lkml.org 
[lkml]   [2026]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH v4 03/17] iio: magnetometer: ak8975: replace usleep_range() with fsleep()
From: Joshua Crofts <joshua.crofts1@gmail.com>

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 | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index dac0a90c33eebd43f8aeed846c9cbf5fd1a6ab91..a84a05a1b64280e26c428e9752a39380e386c234 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -461,7 +461,8 @@ 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 +552,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



\
 
 \ /
  Last update: 2026-05-04 11:52    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog