diff options
author | Brian Masney <masneyb@onstation.org> | 2017-07-07 00:56:24 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2017-07-09 19:30:07 +0200 |
commit | 36a28e4a613bba376959a1b698ae0e1b23d52b59 (patch) | |
tree | a1d942122fdee33488af269ada6e52500e1bfd8e | |
parent | staging: iio: tsl2x7x: refactor {read,write}_event_value to allow handling mu... (diff) | |
download | linux-36a28e4a613bba376959a1b698ae0e1b23d52b59.tar.xz linux-36a28e4a613bba376959a1b698ae0e1b23d52b59.zip |
staging: iio: tsl2x7x: use usleep_range() instead of mdelay()
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>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/staging/iio/light/tsl2x7x.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c index d80f5dcb5c37..c38bd6404726 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", |