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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJSsLiAAAoJEFSFNJnE9BaItv4QAJ+ZYH7fikFLaI0PkSBp1a3l
 2Cs52p+d2/ZLcP2tuFzHAHhhjocx1YJ8PcDyIhZOeuWt98dzcKekLnTsTrHjAvZw
 g5PnPZq2+SQ345MKSq7LZZ0Sz0BoBJ+U4xXQvkQh3XPaoYSoqTQoiMstxme7IlX7
 P1ye1PVDFxlimk0rcpMkUcIl6jW4rVcxOsVVmdbhZ2kz1ia0Zv8kjr68BOTBFyoN
 hAOV9u5ct/XMRKlO/NHnuS8sidn15vI9VP9dQV3rWN8CTNs7yqbDO6GFI7nuc1Xb
 7E3ExoBFCH3dVZQtImBKrZk3HuRqI/TdfhwXFQG9GOslbFGYTKmOebUNeo+uAoP5
 vi81sjTbeUEWIK95CT680csj0BP1Hofq0ivv/p++Osk4+hP/Z8r52E4oYR3z1Jc/
 uZgAaGaItwnVcZnEZPM4B5nJcib+CK+cA4Mt/9iiUvVRbZAg2i6njnHWd8FgOUk/
 0Oj2HfP32oPIgbOYC9YyI2H1guJ/gkVRsZ8oVDiVcsDN2S8HjGDlNkt5NJN3coEL
 5enxTD4bIU1uWVD0JZfsKQcM+j7gdMZGMeytGyuE9hKwp7ua/ccJXG/Pmoq3NBcu
 MBf1E21aldoK1ZRrN0gd3asj7nXsPUl9GvCZeISxsUlNOhPvyappAjGP+t707ZL4
 yar14KkjzjlMw6d4mAsB
 =CtIO
 -----END PGP SIGNATURE-----

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.
This commit is contained in:
Greg Kroah-Hartman 2013-12-17 12:59:55 -08:00
commit 27dc779835
4 changed files with 27 additions and 5 deletions

View file

@ -200,7 +200,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
.address = 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] = {
.type = IIO_VOLTAGE,
@ -210,7 +216,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = {
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
.address = 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),
.int_vref_mv = 2500,

View file

@ -651,7 +651,12 @@ static const struct iio_chan_spec adis16448_channels[] = {
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
.address = ADIS16448_BARO_OUT,
.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),
IIO_CHAN_SOFT_TIMESTAMP(11)

View file

@ -387,7 +387,7 @@ static int cm36651_read_int_time(struct cm36651_data *cm36651,
return -EINVAL;
}
return IIO_VAL_INT_PLUS_MICRO;
return IIO_VAL_INT;
}
static int cm36651_write_int_time(struct cm36651_data *cm36651,

View file

@ -451,7 +451,12 @@ static irqreturn_t hmc5843_trigger_handler(int irq, void *p)
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \
BIT(IIO_CHAN_INFO_SAMP_FREQ), \
.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[] = {