Skip to content

Commit 9579c4d

Browse files
committed
Merge tag 'iio-fixes-for-4.10b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes: Second set of IIO fixes for the 4.10 cycle. * afe4403 - retrieve valid iio_dev in suspend / resume. Previously using the wrong dev for a call to dev_to_iio_dev. * afe4404 - retrieve valid iio_dev in suspend / resume. Previously using the wrong dev for a call to dev_to_iio_dev. * dht11 - Something seems to have caused a regression in timing on the raspberry pi 2B. However, the bug that it threw up was real. msleep was occasionally resulting in very long sleeps, over the limit possible to read from this chip. Switch to usleep_range to avoid this. The timing needed by this part is very fiddly. * max30100 - wrong parenthesis around fifo count check meant it always read after the almost_full state had been reached. I've tagged this with a fixes tag which covers the last patch that it will not need precursor patches. The bug predates that but will need backporting. * palmas_gpadc. - retrieve valid iio_dev in suspend / resume. Previously using the wrong dev for a call to dev_to_iio_dev.
2 parents a121103 + 5c113b5 commit 9579c4d

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

drivers/iio/adc/palmas_gpadc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ static int palmas_adc_wakeup_reset(struct palmas_gpadc *adc)
775775

776776
static int palmas_gpadc_suspend(struct device *dev)
777777
{
778-
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
778+
struct iio_dev *indio_dev = dev_get_drvdata(dev);
779779
struct palmas_gpadc *adc = iio_priv(indio_dev);
780780
int wakeup = adc->wakeup1_enable || adc->wakeup2_enable;
781781
int ret;
@@ -798,7 +798,7 @@ static int palmas_gpadc_suspend(struct device *dev)
798798

799799
static int palmas_gpadc_resume(struct device *dev)
800800
{
801-
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
801+
struct iio_dev *indio_dev = dev_get_drvdata(dev);
802802
struct palmas_gpadc *adc = iio_priv(indio_dev);
803803
int wakeup = adc->wakeup1_enable || adc->wakeup2_enable;
804804
int ret;

drivers/iio/health/afe4403.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ MODULE_DEVICE_TABLE(of, afe4403_of_match);
422422

423423
static int __maybe_unused afe4403_suspend(struct device *dev)
424424
{
425-
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
425+
struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
426426
struct afe4403_data *afe = iio_priv(indio_dev);
427427
int ret;
428428

@@ -443,7 +443,7 @@ static int __maybe_unused afe4403_suspend(struct device *dev)
443443

444444
static int __maybe_unused afe4403_resume(struct device *dev)
445445
{
446-
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
446+
struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
447447
struct afe4403_data *afe = iio_priv(indio_dev);
448448
int ret;
449449

drivers/iio/health/afe4404.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ MODULE_DEVICE_TABLE(of, afe4404_of_match);
428428

429429
static int __maybe_unused afe4404_suspend(struct device *dev)
430430
{
431-
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
431+
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
432432
struct afe4404_data *afe = iio_priv(indio_dev);
433433
int ret;
434434

@@ -449,7 +449,7 @@ static int __maybe_unused afe4404_suspend(struct device *dev)
449449

450450
static int __maybe_unused afe4404_resume(struct device *dev)
451451
{
452-
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
452+
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
453453
struct afe4404_data *afe = iio_priv(indio_dev);
454454
int ret;
455455

drivers/iio/health/max30100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private)
238238

239239
mutex_lock(&data->lock);
240240

241-
while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
241+
while (cnt || (cnt = max30100_fifo_count(data)) > 0) {
242242
ret = max30100_read_measurement(data);
243243
if (ret)
244244
break;

drivers/iio/humidity/dht11.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
* a) select an implementation using busy loop polling on those systems
7272
* b) use the checksum to do some probabilistic decoding
7373
*/
74-
#define DHT11_START_TRANSMISSION 18 /* ms */
74+
#define DHT11_START_TRANSMISSION_MIN 18000 /* us */
75+
#define DHT11_START_TRANSMISSION_MAX 20000 /* us */
7576
#define DHT11_MIN_TIMERES 34000 /* ns */
7677
#define DHT11_THRESHOLD 49000 /* ns */
7778
#define DHT11_AMBIG_LOW 23000 /* ns */
@@ -228,7 +229,8 @@ static int dht11_read_raw(struct iio_dev *iio_dev,
228229
ret = gpio_direction_output(dht11->gpio, 0);
229230
if (ret)
230231
goto err;
231-
msleep(DHT11_START_TRANSMISSION);
232+
usleep_range(DHT11_START_TRANSMISSION_MIN,
233+
DHT11_START_TRANSMISSION_MAX);
232234
ret = gpio_direction_input(dht11->gpio);
233235
if (ret)
234236
goto err;

0 commit comments

Comments
 (0)