Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Brian Masney and committed by
Jonathan Cameron
36a28e4a be78f70c

+3 -2
+3 -2
drivers/staging/iio/light/tsl2x7x.c
··· 686 686 } 687 687 } 688 688 689 - mdelay(3); /* Power-on settling time */ 689 + /* Power-on settling time */ 690 + usleep_range(3000, 3500); 690 691 691 692 /* 692 693 * NOW enable the ADC ··· 854 853 855 854 /*gather the samples*/ 856 855 for (i = 0; i < chip->tsl2x7x_settings.prox_max_samples_cal; i++) { 857 - mdelay(15); 856 + usleep_range(15000, 17500); 858 857 tsl2x7x_get_prox(indio_dev); 859 858 prox_history[i] = chip->prox_data; 860 859 dev_info(&chip->client->dev, "2 i=%d prox data= %d\n",