Skip to content

Commit 49d7edc

Browse files
andy-shevjic23
authored andcommitted
iio: magnetometer: yamaha-yas530: replace usleep_range() with fsleep()
Replace usleep_range() with fsleep() to allow the kernel to select the most appropriate delay mechanism based on duration. Using USEC_PER_MSEC makes the unit conversion explicit. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 6a0814f commit 49d7edc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/iio/magnetometer/yamaha-yas530.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ static int yas537_power_on(struct yas5xx *yas5xx)
13171317
return ret;
13181318

13191319
/* Wait until the coil has ramped up */
1320-
usleep_range(YAS537_MAG_RCOIL_TIME_US, YAS537_MAG_RCOIL_TIME_US + 100);
1320+
fsleep(YAS537_MAG_RCOIL_TIME_US);
13211321

13221322
return 0;
13231323
}
@@ -1426,7 +1426,7 @@ static int yas5xx_probe(struct i2c_client *i2c)
14261426
return dev_err_probe(dev, ret, "cannot enable regulators\n");
14271427

14281428
/* See comment in runtime resume callback */
1429-
usleep_range(31000, 40000);
1429+
fsleep(31 * USEC_PER_MSEC);
14301430

14311431
/* This will take the device out of reset if need be */
14321432
yas5xx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
@@ -1565,7 +1565,7 @@ static int yas5xx_runtime_resume(struct device *dev)
15651565
* for all voltages to settle. The YAS532 is 10ms then 4ms for the
15661566
* I2C to come online. Let's keep it safe and put this at 31ms.
15671567
*/
1568-
usleep_range(31000, 40000);
1568+
fsleep(31 * USEC_PER_MSEC);
15691569
gpiod_set_value_cansleep(yas5xx->reset, 0);
15701570

15711571
ret = ci->power_on(yas5xx);

0 commit comments

Comments
 (0)