Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1682787 > unrolled thread

[PATCH v2 7/9] staging: iio: tsl2x7x: use usleep_range() instead of mdelay()

Started byBrian Masney <masneyb@onstation.org>
First post2017-07-07 01:00 +0200
Last post2017-07-09 19:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 7/9] staging: iio: tsl2x7x: use usleep_range() instead of mdelay() Brian Masney <masneyb@onstation.org> - 2017-07-07 01:00 +0200
    Re: [PATCH v2 7/9] staging: iio: tsl2x7x: use usleep_range()  instead of mdelay() Jonathan Cameron <jic23@kernel.org> - 2017-07-09 19:40 +0200

#1682787 — [PATCH v2 7/9] staging: iio: tsl2x7x: use usleep_range() instead of mdelay()

FromBrian Masney <masneyb@onstation.org>
Date2017-07-07 01:00 +0200
Subject[PATCH v2 7/9] staging: iio: tsl2x7x: use usleep_range() instead of mdelay()
Message-ID<u0nUB-3uc-7@gated-at.bofh.it>
This driver in some cases can busy wait for upwards of 15ms. Since the
kernel at this point is not running in atomic context, and is running in
process context, we can safely use usleep_range() instead. This patch
changes the two occurrences of mdelay() to usleep_range().

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 drivers/staging/iio/light/tsl2x7x.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c
index d80f5dc..c38bd64 100644
--- a/drivers/staging/iio/light/tsl2x7x.c
+++ b/drivers/staging/iio/light/tsl2x7x.c
@@ -686,7 +686,8 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
 		}
 	}
 
-	mdelay(3);	/* Power-on settling time */
+	/* Power-on settling time */
+	usleep_range(3000, 3500);
 
 	/*
 	 * NOW enable the ADC
@@ -853,7 +854,7 @@ static void tsl2x7x_prox_cal(struct iio_dev *indio_dev)
 
 	/*gather the samples*/
 	for (i = 0; i < chip->tsl2x7x_settings.prox_max_samples_cal; i++) {
-		mdelay(15);
+		usleep_range(15000, 17500);
 		tsl2x7x_get_prox(indio_dev);
 		prox_history[i] = chip->prox_data;
 		dev_info(&chip->client->dev, "2 i=%d prox data= %d\n",
-- 
2.9.4

[toc] | [next] | [standalone]


#1683779 — Re: [PATCH v2 7/9] staging: iio: tsl2x7x: use usleep_range() instead of mdelay()

FromJonathan Cameron <jic23@kernel.org>
Date2017-07-09 19:40 +0200
SubjectRe: [PATCH v2 7/9] staging: iio: tsl2x7x: use usleep_range() instead of mdelay()
Message-ID<u1olB-2eX-31@gated-at.bofh.it>
In reply to#1682787
On Thu,  6 Jul 2017 18:56:24 -0400
Brian Masney <masneyb@onstation.org> wrote:

> This driver in some cases can busy wait for upwards of 15ms. Since the
> kernel at this point is not running in atomic context, and is running in
> process context, we can safely use usleep_range() instead. This patch
> changes the two occurrences of mdelay() to usleep_range().
> 
> Signed-off-by: Brian Masney <masneyb@onstation.org>
Applied.  Thanks,

Jonathan
> ---
>  drivers/staging/iio/light/tsl2x7x.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c
> index d80f5dc..c38bd64 100644
> --- a/drivers/staging/iio/light/tsl2x7x.c
> +++ b/drivers/staging/iio/light/tsl2x7x.c
> @@ -686,7 +686,8 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
>  		}
>  	}
>  
> -	mdelay(3);	/* Power-on settling time */
> +	/* Power-on settling time */
> +	usleep_range(3000, 3500);
>  
>  	/*
>  	 * NOW enable the ADC
> @@ -853,7 +854,7 @@ static void tsl2x7x_prox_cal(struct iio_dev *indio_dev)
>  
>  	/*gather the samples*/
>  	for (i = 0; i < chip->tsl2x7x_settings.prox_max_samples_cal; i++) {
> -		mdelay(15);
> +		usleep_range(15000, 17500);
>  		tsl2x7x_get_prox(indio_dev);
>  		prox_history[i] = chip->prox_data;
>  		dev_info(&chip->client->dev, "2 i=%d prox data= %d\n",

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web