* [PATCH v2] iio: pressure: bm1390: replace short msleeps with fsleep
@ 2026-06-09 0:57 Hungyu Lin
2026-06-09 6:14 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Hungyu Lin @ 2026-06-09 0:57 UTC (permalink / raw)
To: Matti Vaittinen
Cc: Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel, Hungyu Lin
Replace msleep(1) with fsleep(1000) for the driver's short
delays.
The BM1390 datasheet specifies a 1 ms reset cancel wait time
(tSC1) during the power-on sequence. Use fsleep() for these
short delays because it automatically selects the most
appropriate sleep mechanism and provides standardized timing
slack.
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
v2:
- Replace usleep_range(1000, 2000) with fsleep(1000)
as suggested by Jonathan Cameron
drivers/iio/pressure/rohm-bm1390.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/pressure/rohm-bm1390.c b/drivers/iio/pressure/rohm-bm1390.c
index 08146ca0f91d..71b08333b746 100644
--- a/drivers/iio/pressure/rohm-bm1390.c
+++ b/drivers/iio/pressure/rohm-bm1390.c
@@ -486,21 +486,21 @@ static int bm1390_chip_init(struct bm1390_data *data)
if (ret)
return ret;
- msleep(1);
+ fsleep(1000);
ret = regmap_write_bits(data->regmap, BM1390_REG_RESET,
BM1390_MASK_RESET, BM1390_RESET);
if (ret)
return ret;
- msleep(1);
+ fsleep(1000);
ret = regmap_write_bits(data->regmap, BM1390_REG_RESET,
BM1390_MASK_RESET, BM1390_RESET_RELEASE);
if (ret)
return ret;
- msleep(1);
+ fsleep(1000);
ret = regmap_reinit_cache(data->regmap, &bm1390_regmap);
if (ret) {
@@ -575,7 +575,7 @@ static int bm1390_fifo_disable(struct iio_dev *idev)
struct bm1390_data *data = iio_priv(idev);
int ret;
- msleep(1);
+ fsleep(1000);
guard(mutex)(&data->mutex);
ret = bm1390_meas_set(data, BM1390_MEAS_MODE_STOP);
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] iio: pressure: bm1390: replace short msleeps with fsleep
2026-06-09 0:57 [PATCH v2] iio: pressure: bm1390: replace short msleeps with fsleep Hungyu Lin
@ 2026-06-09 6:14 ` Andy Shevchenko
2026-06-10 15:37 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2026-06-09 6:14 UTC (permalink / raw)
To: Hungyu Lin
Cc: Matti Vaittinen, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
On Tue, Jun 09, 2026 at 12:57:10AM +0000, Hungyu Lin wrote:
> Replace msleep(1) with fsleep(1000) for the driver's short
> delays.
>
> The BM1390 datasheet specifies a 1 ms reset cancel wait time
> (tSC1) during the power-on sequence. Use fsleep() for these
> short delays because it automatically selects the most
> appropriate sleep mechanism and provides standardized timing
> slack.
Same comment as per v1.
...
> - msleep(1);
> + fsleep(1000);
And in case you really still want to do this, use multipliers
fsleep(1 * USEC_PER_MSEC);
(but this might require time.h to be included).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] iio: pressure: bm1390: replace short msleeps with fsleep
2026-06-09 6:14 ` Andy Shevchenko
@ 2026-06-10 15:37 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2026-06-10 15:37 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Hungyu Lin, Matti Vaittinen, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
On Tue, 9 Jun 2026 09:14:57 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Tue, Jun 09, 2026 at 12:57:10AM +0000, Hungyu Lin wrote:
> > Replace msleep(1) with fsleep(1000) for the driver's short
> > delays.
> >
> > The BM1390 datasheet specifies a 1 ms reset cancel wait time
> > (tSC1) during the power-on sequence. Use fsleep() for these
> > short delays because it automatically selects the most
> > appropriate sleep mechanism and provides standardized timing
> > slack.
>
> Same comment as per v1.
>
> ...
>
> > - msleep(1);
> > + fsleep(1000);
>
> And in case you really still want to do this, use multipliers
>
> fsleep(1 * USEC_PER_MSEC);
>
> (but this might require time.h to be included).
>
We seem to have a consensus that this is really just adding noise
in this particular case, so let us drop this one.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-10 15:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-09 0:57 [PATCH v2] iio: pressure: bm1390: replace short msleeps with fsleep Hungyu Lin
2026-06-09 6:14 ` Andy Shevchenko
2026-06-10 15:37 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®