The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 3/3] iio: magnetometer: yamaha-yas530: replace usleep_range() with fsleep()
Date: Fri,  8 May 2026 08:08:35 +0200	[thread overview]
Message-ID: <20260508060958.1086818-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260508060958.1086818-1-andriy.shevchenko@linux.intel.com>

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>
---
 drivers/iio/magnetometer/yamaha-yas530.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c
index d6efa8a595b0..75ff2ba0c23f 100644
--- a/drivers/iio/magnetometer/yamaha-yas530.c
+++ b/drivers/iio/magnetometer/yamaha-yas530.c
@@ -1317,7 +1317,7 @@ static int yas537_power_on(struct yas5xx *yas5xx)
 		return ret;
 
 	/* Wait until the coil has ramped up */
-	usleep_range(YAS537_MAG_RCOIL_TIME_US, YAS537_MAG_RCOIL_TIME_US + 100);
+	fsleep(YAS537_MAG_RCOIL_TIME_US);
 
 	return 0;
 }
@@ -1426,7 +1426,7 @@ static int yas5xx_probe(struct i2c_client *i2c)
 		return dev_err_probe(dev, ret, "cannot enable regulators\n");
 
 	/* See comment in runtime resume callback */
-	usleep_range(31000, 40000);
+	fsleep(31 * USEC_PER_MSEC);
 
 	/* This will take the device out of reset if need be */
 	yas5xx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
@@ -1565,7 +1565,7 @@ static int yas5xx_runtime_resume(struct device *dev)
 	 * for all voltages to settle. The YAS532 is 10ms then 4ms for the
 	 * I2C to come online. Let's keep it safe and put this at 31ms.
 	 */
-	usleep_range(31000, 40000);
+	fsleep(31 * USEC_PER_MSEC);
 	gpiod_set_value_cansleep(yas5xx->reset, 0);
 
 	ret = ci->power_on(yas5xx);
-- 
2.50.1


  parent reply	other threads:[~2026-05-08  6:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08  6:08 [PATCH v1 0/3] iio: magnetometer: yamaha-yas530: Ad-hoc cleanups Andy Shevchenko
2026-05-08  6:08 ` [PATCH v1 1/3] iio: magnetometer: yamaha-yas530: Get rid of i2c_client_get_device_id() Andy Shevchenko
2026-05-08  6:08 ` [PATCH v1 2/3] iio: magnetometer: yamaha-yas530: Use devm_mutex_init() for mutex initialization Andy Shevchenko
2026-05-08  6:08 ` Andy Shevchenko [this message]
2026-05-08 13:32 ` [PATCH v1 0/3] iio: magnetometer: yamaha-yas530: Ad-hoc cleanups Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260508060958.1086818-4-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox