aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/imu
diff options
context:
space:
mode:
authorMarcus Folkesson <marcus.folkesson@gmail.com>2014-01-24 06:24:00 -0500
committerJonathan Cameron <jic23@kernel.org>2014-02-08 06:26:06 -0500
commitc76782d151dab7ecfdcdf9a01561c2d61d9b490f (patch)
tree222af39a5e74e699001ffaad38b6283c7b603ef7 /drivers/iio/imu
parentbef44abccb2677e8d16e50b75316d4fd1061be81 (diff)
iio: adis16400: Set timestamp as the last element in chan_spec
This is necessary since timestamp is calculated as the last element in iio_compute_scan_bytes(). Without this fix any userspace code reading the layout of the buffer via sysfs will incorrectly interpret the data leading some nasty corruption. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/imu')
-rw-r--r--drivers/iio/imu/adis16400.h1
-rw-r--r--drivers/iio/imu/adis16400_core.c10
2 files changed, 6 insertions, 5 deletions
diff --git a/drivers/iio/imu/adis16400.h b/drivers/iio/imu/adis16400.h
index 2f8f9d632386..0916bf6b6c31 100644
--- a/drivers/iio/imu/adis16400.h
+++ b/drivers/iio/imu/adis16400.h
@@ -189,6 +189,7 @@ enum {
189 ADIS16300_SCAN_INCLI_X, 189 ADIS16300_SCAN_INCLI_X,
190 ADIS16300_SCAN_INCLI_Y, 190 ADIS16300_SCAN_INCLI_Y,
191 ADIS16400_SCAN_ADC, 191 ADIS16400_SCAN_ADC,
192 ADIS16400_SCAN_TIMESTAMP,
192}; 193};
193 194
194#ifdef CONFIG_IIO_BUFFER 195#ifdef CONFIG_IIO_BUFFER
diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
index 368660dfe135..7c582f7ae34e 100644
--- a/drivers/iio/imu/adis16400_core.c
+++ b/drivers/iio/imu/adis16400_core.c
@@ -632,7 +632,7 @@ static const struct iio_chan_spec adis16400_channels[] = {
632 ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14), 632 ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14),
633 ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12), 633 ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12),
634 ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12), 634 ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12),
635 IIO_CHAN_SOFT_TIMESTAMP(12) 635 IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
636}; 636};
637 637
638static const struct iio_chan_spec adis16448_channels[] = { 638static const struct iio_chan_spec adis16448_channels[] = {
@@ -659,7 +659,7 @@ static const struct iio_chan_spec adis16448_channels[] = {
659 }, 659 },
660 }, 660 },
661 ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12), 661 ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
662 IIO_CHAN_SOFT_TIMESTAMP(11) 662 IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
663}; 663};
664 664
665static const struct iio_chan_spec adis16350_channels[] = { 665static const struct iio_chan_spec adis16350_channels[] = {
@@ -677,7 +677,7 @@ static const struct iio_chan_spec adis16350_channels[] = {
677 ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12), 677 ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12),
678 ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12), 678 ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12),
679 ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12), 679 ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12),
680 IIO_CHAN_SOFT_TIMESTAMP(11) 680 IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
681}; 681};
682 682
683static const struct iio_chan_spec adis16300_channels[] = { 683static const struct iio_chan_spec adis16300_channels[] = {
@@ -690,7 +690,7 @@ static const struct iio_chan_spec adis16300_channels[] = {
690 ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12), 690 ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12),
691 ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13), 691 ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13),
692 ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13), 692 ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13),
693 IIO_CHAN_SOFT_TIMESTAMP(14) 693 IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
694}; 694};
695 695
696static const struct iio_chan_spec adis16334_channels[] = { 696static const struct iio_chan_spec adis16334_channels[] = {
@@ -701,7 +701,7 @@ static const struct iio_chan_spec adis16334_channels[] = {
701 ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14), 701 ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14),
702 ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14), 702 ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14),
703 ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12), 703 ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12),
704 IIO_CHAN_SOFT_TIMESTAMP(8) 704 IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
705}; 705};
706 706
707static struct attribute *adis16400_attributes[] = { 707static struct attribute *adis16400_attributes[] = {