mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Hungyu Lin <dennylin0707@gmail.com>
Cc: "Matti Vaittinen" <mazziesaccount@gmail.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: pressure: bm1390: replace short msleeps with usleep_range
Date: Mon, 8 Jun 2026 18:41:54 +0100	[thread overview]
Message-ID: <20260608184154.72a88788@jic23-huawei> (raw)
In-Reply-To: <20260607140018.59586-1-dennylin0707@gmail.com>

On Sun,  7 Jun 2026 14:00:18 +0000
Hungyu Lin <dennylin0707@gmail.com> wrote:

> Replace msleep(1) with usleep_range(1000, 2000) for the
> driver's short delays.
> 
> The BM1390 datasheet specifies a 1 ms reset cancel wait time
> (tSC1) during the power-on sequence. Use usleep_range() for
> these short delays, as it is more appropriate than msleep()
> and avoids unnecessarily long sleeps.

Hi Hungyu,

Use fsleep() which has the added advantage of standardizing the
'slack' so we don't have to thing about the values chosen

Thanks,

Jonathan

> 
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
>  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..35b9abc25a8a 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);
> +	usleep_range(1000, 2000);
>  
>  	ret = regmap_write_bits(data->regmap, BM1390_REG_RESET,
>  				BM1390_MASK_RESET, BM1390_RESET);
>  	if (ret)
>  		return ret;
>  
> -	msleep(1);
> +	usleep_range(1000, 2000);
>  
>  	ret = regmap_write_bits(data->regmap, BM1390_REG_RESET,
>  				BM1390_MASK_RESET, BM1390_RESET_RELEASE);
>  	if (ret)
>  		return ret;
>  
> -	msleep(1);
> +	usleep_range(1000, 2000);
>  
>  	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);
> +	usleep_range(1000, 2000);
>  
>  	guard(mutex)(&data->mutex);
>  	ret = bm1390_meas_set(data, BM1390_MEAS_MODE_STOP);


  reply	other threads:[~2026-06-08 17:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07 14:00 Hungyu Lin
2026-06-08 17:41 ` Jonathan Cameron [this message]
2026-06-09  6:13   ` Andy Shevchenko
2026-06-09  9:59     ` Matti Vaittinen
2026-06-15 20:51       ` Hungyu Lin
2026-06-16  7:37         ` Andy Shevchenko

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=20260608184154.72a88788@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=dennylin0707@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --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

all inboxes | Powered by JetHome®