aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-07 03:42:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-07 03:42:27 -0500
commit371c6d972709bdd6254832c1aecf3ebf2fdd11c6 (patch)
tree35f3a19d87d206c380ba96f8bf1ac8d28655c759 /drivers/staging
parenta909d3e636995ba7c349e2ca5dbb528154d4ac30 (diff)
parent6f77199e9e4b84340c751c585691d7642a47d226 (diff)
Merge tag 'iio-fixes-for-4.9b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Second set of IIO fixes for the 4.9 cycle. Interestingly scale related fixes for accelerometers at both ends of the range. Obviously more varied devices turning up than we've seen before! * ad5933 - fix an uninitialized value in a return case that is winding up GCC. * hid sensors - missing pm function prevents hid rotations sensors from working on newer ISH hubs (works by luck on older ones) - increase of scale precision needed to fix a case where on a yoga 260 the reported scale is 0 (presumably a high precision but very low g sensor). * st_sensors - fix an issue seen with the hs3lis331dl where the range is much greater than previous devices (100's of g) and hence the per bit scale is greater than 1.
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/iio/impedance-analyzer/ad5933.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 5eecf1cb1028..3892a7470410 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -655,6 +655,7 @@ static void ad5933_work(struct work_struct *work)
655 __be16 buf[2]; 655 __be16 buf[2];
656 int val[2]; 656 int val[2];
657 unsigned char status; 657 unsigned char status;
658 int ret;
658 659
659 mutex_lock(&indio_dev->mlock); 660 mutex_lock(&indio_dev->mlock);
660 if (st->state == AD5933_CTRL_INIT_START_FREQ) { 661 if (st->state == AD5933_CTRL_INIT_START_FREQ) {
@@ -662,19 +663,22 @@ static void ad5933_work(struct work_struct *work)
662 ad5933_cmd(st, AD5933_CTRL_START_SWEEP); 663 ad5933_cmd(st, AD5933_CTRL_START_SWEEP);
663 st->state = AD5933_CTRL_START_SWEEP; 664 st->state = AD5933_CTRL_START_SWEEP;
664 schedule_delayed_work(&st->work, st->poll_time_jiffies); 665 schedule_delayed_work(&st->work, st->poll_time_jiffies);
665 mutex_unlock(&indio_dev->mlock); 666 goto out;
666 return;
667 } 667 }
668 668
669 ad5933_i2c_read(st->client, AD5933_REG_STATUS, 1, &status); 669 ret = ad5933_i2c_read(st->client, AD5933_REG_STATUS, 1, &status);
670 if (ret)
671 goto out;
670 672
671 if (status & AD5933_STAT_DATA_VALID) { 673 if (status & AD5933_STAT_DATA_VALID) {
672 int scan_count = bitmap_weight(indio_dev->active_scan_mask, 674 int scan_count = bitmap_weight(indio_dev->active_scan_mask,
673 indio_dev->masklength); 675 indio_dev->masklength);
674 ad5933_i2c_read(st->client, 676 ret = ad5933_i2c_read(st->client,
675 test_bit(1, indio_dev->active_scan_mask) ? 677 test_bit(1, indio_dev->active_scan_mask) ?
676 AD5933_REG_REAL_DATA : AD5933_REG_IMAG_DATA, 678 AD5933_REG_REAL_DATA : AD5933_REG_IMAG_DATA,
677 scan_count * 2, (u8 *)buf); 679 scan_count * 2, (u8 *)buf);
680 if (ret)
681 goto out;
678 682
679 if (scan_count == 2) { 683 if (scan_count == 2) {
680 val[0] = be16_to_cpu(buf[0]); 684 val[0] = be16_to_cpu(buf[0]);
@@ -686,8 +690,7 @@ static void ad5933_work(struct work_struct *work)
686 } else { 690 } else {
687 /* no data available - try again later */ 691 /* no data available - try again later */
688 schedule_delayed_work(&st->work, st->poll_time_jiffies); 692 schedule_delayed_work(&st->work, st->poll_time_jiffies);
689 mutex_unlock(&indio_dev->mlock); 693 goto out;
690 return;
691 } 694 }
692 695
693 if (status & AD5933_STAT_SWEEP_DONE) { 696 if (status & AD5933_STAT_SWEEP_DONE) {
@@ -700,7 +703,7 @@ static void ad5933_work(struct work_struct *work)
700 ad5933_cmd(st, AD5933_CTRL_INC_FREQ); 703 ad5933_cmd(st, AD5933_CTRL_INC_FREQ);
701 schedule_delayed_work(&st->work, st->poll_time_jiffies); 704 schedule_delayed_work(&st->work, st->poll_time_jiffies);
702 } 705 }
703 706out:
704 mutex_unlock(&indio_dev->mlock); 707 mutex_unlock(&indio_dev->mlock);
705} 708}
706 709