Commit 27dc7798 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'iio-fixes-for-3.13c' of...

Merge tag 'iio-fixes-for-3.13c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

Third set of fixes for IIO in the 3.13 cycle.

* Fix for a bug in the new cm36651 driver where it told the IIO driver it
  was providing a decimal part, but then didn't.  Now it correctly tells the
  IIO core that it is only providing an integer value.  This prevents random
  incorrect values being output on a sysfs read.

* 3 fixes where drivers were miss specifying the endianness of their channels
  as output through the buffer interface.  These were discovered whilst
  removing the terrible IIO_ST macro once and for all.  The result is that
  userspace may be informed that the buffer elements are being output as
  little endian (on little endian platforms) when infact they are big endian.
  Thus userspace will handle them incorrectly.  This incorrect buffer
  element specification is provided as sysfs attributes under
  iio:deviceN/scan_elements.
parents 319e2e3f e39d9905
...@@ -200,7 +200,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = { ...@@ -200,7 +200,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
.address = 1, .address = 1,
.scan_index = 1, .scan_index = 1,
.scan_type = IIO_ST('u', 12, 16, 0), .scan_type = {
.sign = 'u',
.realbits = 12,
.storagebits = 16,
.shift = 0,
.endianness = IIO_BE,
},
}, },
.channel[1] = { .channel[1] = {
.type = IIO_VOLTAGE, .type = IIO_VOLTAGE,
...@@ -210,7 +216,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = { ...@@ -210,7 +216,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
.address = 0, .address = 0,
.scan_index = 0, .scan_index = 0,
.scan_type = IIO_ST('u', 12, 16, 0), .scan_type = {
.sign = 'u',
.realbits = 12,
.storagebits = 16,
.shift = 0,
.endianness = IIO_BE,
},
}, },
.channel[2] = IIO_CHAN_SOFT_TIMESTAMP(2), .channel[2] = IIO_CHAN_SOFT_TIMESTAMP(2),
.int_vref_mv = 2500, .int_vref_mv = 2500,
......
...@@ -651,7 +651,12 @@ static const struct iio_chan_spec adis16448_channels[] = { ...@@ -651,7 +651,12 @@ static const struct iio_chan_spec adis16448_channels[] = {
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
.address = ADIS16448_BARO_OUT, .address = ADIS16448_BARO_OUT,
.scan_index = ADIS16400_SCAN_BARO, .scan_index = ADIS16400_SCAN_BARO,
.scan_type = IIO_ST('s', 16, 16, 0), .scan_type = {
.sign = 's',
.realbits = 16,
.storagebits = 16,
.endianness = IIO_BE,
},
}, },
ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12), ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
IIO_CHAN_SOFT_TIMESTAMP(11) IIO_CHAN_SOFT_TIMESTAMP(11)
......
...@@ -387,7 +387,7 @@ static int cm36651_read_int_time(struct cm36651_data *cm36651, ...@@ -387,7 +387,7 @@ static int cm36651_read_int_time(struct cm36651_data *cm36651,
return -EINVAL; return -EINVAL;
} }
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT;
} }
static int cm36651_write_int_time(struct cm36651_data *cm36651, static int cm36651_write_int_time(struct cm36651_data *cm36651,
......
...@@ -451,7 +451,12 @@ static irqreturn_t hmc5843_trigger_handler(int irq, void *p) ...@@ -451,7 +451,12 @@ static irqreturn_t hmc5843_trigger_handler(int irq, void *p)
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \
BIT(IIO_CHAN_INFO_SAMP_FREQ), \ BIT(IIO_CHAN_INFO_SAMP_FREQ), \
.scan_index = idx, \ .scan_index = idx, \
.scan_type = IIO_ST('s', 16, 16, IIO_BE), \ .scan_type = { \
.sign = 's', \
.realbits = 16, \
.storagebits = 16, \
.endianness = IIO_BE, \
}, \
} }
static const struct iio_chan_spec hmc5843_channels[] = { static const struct iio_chan_spec hmc5843_channels[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment