First set of IIO fixes for the 4.9 cycle.

* atlas chemical
   - Fix alignment of big endian values in a larger storage (by using the right
   size storage)
 * maxim thermocouple
   - Fix alignment of big endian values in larger (by using the correct
   sized storage).
 * sca3000
   - Handle unexpected mode values.
 * ti-adc081
   - Select IIO_TRIGGERED_BUFFER to avoid build errors
 -----BEGIN PGP SIGNATURE-----
 
 iQIuBAABCAAYBQJYDSpNERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIv80P
 /0QCSY52U6sQt01ybdxyPhwZ6EfIxzzv64ukSHIFJBgQee1Z143tvAPVM80ZcIPW
 oSOD9Cy3HABPFhLEnmTkAtUD69kguYGQmvnRxFhslVl0Skxo19gUhz/sWI9sR/5l
 KG4/8Z/vXL9CYyurF/FCuWnYOu6tKK9Ody4AkMc7UTDNrON6agGQZh32W9PwRsrH
 7aElCfyhom19vkZ37Odzgovl5FQ6eBcFjV6RarhihN/r7aV0wSn4fsuFPTrdKB+N
 509FOr3/Vy+rBBtwwKyxNIMWhgO1tHEGKNR+ZKLENnMJUU3eixsWST1+wM6W7QoW
 rVymu/nRPeWbWdqBH/wMlt7zuwZXqiRPNOP1Eyjg6PXRambdiu6UI+whOYxK6/7+
 +xExQ1xDG4SkzXUtRXSUOgbiJfjcu5PlHiqnPVjs8qgFMuYChVnw0DYnX7uuQKxT
 vIo0jA26BW32Rv5iJ07AIHAq0gJ+lo7NBDNMN5D33JLioiiVKxa+qsyWHpoUYMIR
 o3IcMTuMMPAoFzGkvVdR85rO4D8nL87CDYj0QrA2T6arcKFtMybSPr19+yL8lOF4
 KzI17dZqpW+5yYQxS8jEqbykuylp0jyDVgY8ecHsQ5SX7QtgmerN54FJc/UJvnhZ
 1aN/BV6VNcbEpDtefhLMhgOIOUEPnQHpd8wK377W8us/
 =jpcn
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of IIO fixes for the 4.9 cycle.

* atlas chemical
  - Fix alignment of big endian values in a larger storage (by using the right
  size storage)
* maxim thermocouple
  - Fix alignment of big endian values in larger (by using the correct
  sized storage).
* sca3000
  - Handle unexpected mode values.
* ti-adc081
  - Select IIO_TRIGGERED_BUFFER to avoid build errors
This commit is contained in:
Greg Kroah-Hartman 2016-10-24 10:50:13 +02:00
commit 8b77eb97f7
4 changed files with 17 additions and 10 deletions

View file

@ -437,6 +437,8 @@ config STX104
config TI_ADC081C config TI_ADC081C
tristate "Texas Instruments ADC081C/ADC101C/ADC121C family" tristate "Texas Instruments ADC081C/ADC101C/ADC121C family"
depends on I2C depends on I2C
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
help help
If you say yes here you get support for Texas Instruments ADC081C, If you say yes here you get support for Texas Instruments ADC081C,
ADC101C and ADC121C ADC chips. ADC101C and ADC121C ADC chips.

View file

@ -213,13 +213,14 @@ static int atlas_check_ec_calibration(struct atlas_data *data)
struct device *dev = &data->client->dev; struct device *dev = &data->client->dev;
int ret; int ret;
unsigned int val; unsigned int val;
__be16 rval;
ret = regmap_bulk_read(data->regmap, ATLAS_REG_EC_PROBE, &val, 2); ret = regmap_bulk_read(data->regmap, ATLAS_REG_EC_PROBE, &rval, 2);
if (ret) if (ret)
return ret; return ret;
dev_info(dev, "probe set to K = %d.%.2d", be16_to_cpu(val) / 100, val = be16_to_cpu(rval);
be16_to_cpu(val) % 100); dev_info(dev, "probe set to K = %d.%.2d", val / 100, val % 100);
ret = regmap_read(data->regmap, ATLAS_REG_EC_CALIB_STATUS, &val); ret = regmap_read(data->regmap, ATLAS_REG_EC_CALIB_STATUS, &val);
if (ret) if (ret)

View file

@ -123,22 +123,24 @@ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,
{ {
unsigned int storage_bytes = data->chip->read_size; unsigned int storage_bytes = data->chip->read_size;
unsigned int shift = chan->scan_type.shift + (chan->address * 8); unsigned int shift = chan->scan_type.shift + (chan->address * 8);
unsigned int buf; __be16 buf16;
__be32 buf32;
int ret; int ret;
ret = spi_read(data->spi, (void *) &buf, storage_bytes);
if (ret)
return ret;
switch (storage_bytes) { switch (storage_bytes) {
case 2: case 2:
*val = be16_to_cpu(buf); ret = spi_read(data->spi, (void *)&buf16, storage_bytes);
*val = be16_to_cpu(buf16);
break; break;
case 4: case 4:
*val = be32_to_cpu(buf); ret = spi_read(data->spi, (void *)&buf32, storage_bytes);
*val = be32_to_cpu(buf32);
break; break;
} }
if (ret)
return ret;
/* check to be sure this is a valid reading */ /* check to be sure this is a valid reading */
if (*val & data->chip->status_bit) if (*val & data->chip->status_bit)
return -EINVAL; return -EINVAL;

View file

@ -468,6 +468,8 @@ static inline int __sca3000_get_base_freq(struct sca3000_state *st,
case SCA3000_MEAS_MODE_OP_2: case SCA3000_MEAS_MODE_OP_2:
*base_freq = info->option_mode_2_freq; *base_freq = info->option_mode_2_freq;
break; break;
default:
ret = -EINVAL;
} }
error_ret: error_ret:
return ret; return ret;