aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-24 04:50:13 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-24 04:50:13 -0400
commit8b77eb97f7847d67129d5312596e953bd7946f48 (patch)
tree754eca1f2ca367b93cead00c4135056b4ab9fcbe
parentc89d98e224b4858f42a9fec0f16766b3d7669ba3 (diff)
parent64bc2d02d754f4143d65cc21c644176db12ab5c8 (diff)
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
-rw-r--r--drivers/iio/adc/Kconfig2
-rw-r--r--drivers/iio/chemical/atlas-ph-sensor.c7
-rw-r--r--drivers/iio/temperature/maxim_thermocouple.c16
-rw-r--r--drivers/staging/iio/accel/sca3000_core.c2
4 files changed, 17 insertions, 10 deletions
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 7edcf3238620..99c051490eff 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -437,6 +437,8 @@ config STX104
437config TI_ADC081C 437config TI_ADC081C
438 tristate "Texas Instruments ADC081C/ADC101C/ADC121C family" 438 tristate "Texas Instruments ADC081C/ADC101C/ADC121C family"
439 depends on I2C 439 depends on I2C
440 select IIO_BUFFER
441 select IIO_TRIGGERED_BUFFER
440 help 442 help
441 If you say yes here you get support for Texas Instruments ADC081C, 443 If you say yes here you get support for Texas Instruments ADC081C,
442 ADC101C and ADC121C ADC chips. 444 ADC101C and ADC121C ADC chips.
diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
index bd321b305a0a..ef761a508630 100644
--- a/drivers/iio/chemical/atlas-ph-sensor.c
+++ b/drivers/iio/chemical/atlas-ph-sensor.c
@@ -213,13 +213,14 @@ static int atlas_check_ec_calibration(struct atlas_data *data)
213 struct device *dev = &data->client->dev; 213 struct device *dev = &data->client->dev;
214 int ret; 214 int ret;
215 unsigned int val; 215 unsigned int val;
216 __be16 rval;
216 217
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);
218 if (ret) 219 if (ret)
219 return ret; 220 return ret;
220 221
221 dev_info(dev, "probe set to K = %d.%.2d", be16_to_cpu(val) / 100, 222 val = be16_to_cpu(rval);
222 be16_to_cpu(val) % 100); 223 dev_info(dev, "probe set to K = %d.%.2d", val / 100, val % 100);
223 224
224 ret = regmap_read(data->regmap, ATLAS_REG_EC_CALIB_STATUS, &val); 225 ret = regmap_read(data->regmap, ATLAS_REG_EC_CALIB_STATUS, &val);
225 if (ret) 226 if (ret)
diff --git a/drivers/iio/temperature/maxim_thermocouple.c b/drivers/iio/temperature/maxim_thermocouple.c
index 39dd2026ccc9..066161a4bccd 100644
--- a/drivers/iio/temperature/maxim_thermocouple.c
+++ b/drivers/iio/temperature/maxim_thermocouple.c
@@ -123,22 +123,24 @@ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,
123{ 123{
124 unsigned int storage_bytes = data->chip->read_size; 124 unsigned int storage_bytes = data->chip->read_size;
125 unsigned int shift = chan->scan_type.shift + (chan->address * 8); 125 unsigned int shift = chan->scan_type.shift + (chan->address * 8);
126 unsigned int buf; 126 __be16 buf16;
127 __be32 buf32;
127 int ret; 128 int ret;
128 129
129 ret = spi_read(data->spi, (void *) &buf, storage_bytes);
130 if (ret)
131 return ret;
132
133 switch (storage_bytes) { 130 switch (storage_bytes) {
134 case 2: 131 case 2:
135 *val = be16_to_cpu(buf); 132 ret = spi_read(data->spi, (void *)&buf16, storage_bytes);
133 *val = be16_to_cpu(buf16);
136 break; 134 break;
137 case 4: 135 case 4:
138 *val = be32_to_cpu(buf); 136 ret = spi_read(data->spi, (void *)&buf32, storage_bytes);
137 *val = be32_to_cpu(buf32);
139 break; 138 break;
140 } 139 }
141 140
141 if (ret)
142 return ret;
143
142 /* check to be sure this is a valid reading */ 144 /* check to be sure this is a valid reading */
143 if (*val & data->chip->status_bit) 145 if (*val & data->chip->status_bit)
144 return -EINVAL; 146 return -EINVAL;
diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c
index d626125d7af9..564b36d4f648 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -468,6 +468,8 @@ static inline int __sca3000_get_base_freq(struct sca3000_state *st,
468 case SCA3000_MEAS_MODE_OP_2: 468 case SCA3000_MEAS_MODE_OP_2:
469 *base_freq = info->option_mode_2_freq; 469 *base_freq = info->option_mode_2_freq;
470 break; 470 break;
471 default:
472 ret = -EINVAL;
471 } 473 }
472error_ret: 474error_ret:
473 return ret; 475 return ret;