Skip to content

Commit 8b77eb9

Browse files
committed
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
2 parents c89d98e + 64bc2d0 commit 8b77eb9

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

drivers/iio/adc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ config STX104
437437
config TI_ADC081C
438438
tristate "Texas Instruments ADC081C/ADC101C/ADC121C family"
439439
depends on I2C
440+
select IIO_BUFFER
441+
select IIO_TRIGGERED_BUFFER
440442
help
441443
If you say yes here you get support for Texas Instruments ADC081C,
442444
ADC101C and ADC121C ADC chips.

drivers/iio/chemical/atlas-ph-sensor.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,14 @@ static int atlas_check_ec_calibration(struct atlas_data *data)
213213
struct device *dev = &data->client->dev;
214214
int ret;
215215
unsigned int val;
216+
__be16 rval;
216217

217-
ret = regmap_bulk_read(data->regmap, ATLAS_REG_EC_PROBE, &val, 2);
218+
ret = regmap_bulk_read(data->regmap, ATLAS_REG_EC_PROBE, &rval, 2);
218219
if (ret)
219220
return ret;
220221

221-
dev_info(dev, "probe set to K = %d.%.2d", be16_to_cpu(val) / 100,
222-
be16_to_cpu(val) % 100);
222+
val = be16_to_cpu(rval);
223+
dev_info(dev, "probe set to K = %d.%.2d", val / 100, val % 100);
223224

224225
ret = regmap_read(data->regmap, ATLAS_REG_EC_CALIB_STATUS, &val);
225226
if (ret)

drivers/iio/temperature/maxim_thermocouple.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,24 @@ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,
123123
{
124124
unsigned int storage_bytes = data->chip->read_size;
125125
unsigned int shift = chan->scan_type.shift + (chan->address * 8);
126-
unsigned int buf;
126+
__be16 buf16;
127+
__be32 buf32;
127128
int ret;
128129

129-
ret = spi_read(data->spi, (void *) &buf, storage_bytes);
130-
if (ret)
131-
return ret;
132-
133130
switch (storage_bytes) {
134131
case 2:
135-
*val = be16_to_cpu(buf);
132+
ret = spi_read(data->spi, (void *)&buf16, storage_bytes);
133+
*val = be16_to_cpu(buf16);
136134
break;
137135
case 4:
138-
*val = be32_to_cpu(buf);
136+
ret = spi_read(data->spi, (void *)&buf32, storage_bytes);
137+
*val = be32_to_cpu(buf32);
139138
break;
140139
}
141140

141+
if (ret)
142+
return ret;
143+
142144
/* check to be sure this is a valid reading */
143145
if (*val & data->chip->status_bit)
144146
return -EINVAL;

drivers/staging/iio/accel/sca3000_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ static inline int __sca3000_get_base_freq(struct sca3000_state *st,
468468
case SCA3000_MEAS_MODE_OP_2:
469469
*base_freq = info->option_mode_2_freq;
470470
break;
471+
default:
472+
ret = -EINVAL;
471473
}
472474
error_ret:
473475
return ret;

0 commit comments

Comments
 (0)