]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: magnetometer: ak8975: replace usleep_range() with fsleep()
authorJoshua Crofts <joshua.crofts1@gmail.com>
Tue, 5 May 2026 11:45:59 +0000 (13:45 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 09:59:36 +0000 (10:59 +0100)
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>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/magnetometer/ak8975.c

index c401120a5f8ba70be34dde8f239c25fea6532d92..b15ac73b37edc5c50f43cf973a538b6c110cae1d 100644 (file)
@@ -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;
 }