Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1677982
| From | Brian Masney <masneyb@onstation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 6/6] staging: iio: tsl2x7x: use usleep_range() instead of mdelay() |
| Date | 2017-06-29 19:20 +0200 |
| Message-ID | <tXLgL-1X8-45@gated-at.bofh.it> (permalink) |
| References | <tXLgK-1X8-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 6a5d58c..8195faa 100644
--- a/drivers/staging/iio/light/tsl2x7x.c
+++ b/drivers/staging/iio/light/tsl2x7x.c
@@ -687,7 +687,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
@@ -854,7 +855,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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/6] staging: iio: tsl2x7x: staging cleanups Brian Masney <masneyb@onstation.org> - 2017-06-29 19:20 +0200
[PATCH 2/6] staging: iio: tsl2x7x: remove redundant power_state sysfs attribute Brian Masney <masneyb@onstation.org> - 2017-06-29 19:20 +0200
[PATCH 6/6] staging: iio: tsl2x7x: use usleep_range() instead of mdelay() Brian Masney <masneyb@onstation.org> - 2017-06-29 19:20 +0200
[PATCH 1/6] staging: iio: tsl2x7x: add of_match table for device tree support Brian Masney <masneyb@onstation.org> - 2017-06-29 19:20 +0200
[PATCH 3/6] staging: iio: tsl2x7x: remove tsl2x7x_i2c_read() Brian Masney <masneyb@onstation.org> - 2017-06-29 19:20 +0200
Re: [PATCH 3/6] staging: iio: tsl2x7x: remove tsl2x7x_i2c_read() Frans Klaver <fransklaver@gmail.com> - 2017-06-29 21:30 +0200
Re: [PATCH 0/6] staging: iio: tsl2x7x: staging cleanups Brian Masney <masneyb@onstation.org> - 2017-06-30 17:30 +0200
RE: [PATCH 0/6] staging: iio: tsl2x7x: staging cleanups Jon Brenner <Jon.Brenner@ams.com> - 2017-06-30 18:20 +0200
Re: [PATCH 0/6] staging: iio: tsl2x7x: staging cleanups Jonathan Cameron <jic23@kernel.org> - 2017-07-01 11:50 +0200
csiph-web