aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-01 16:07:38 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-01 16:07:38 -0500
commit48436e82fd2925a42293f670f3570b5c855c90c1 (patch)
treeb1a287422058b4ce42995b7f24a03c01fd3b54a2
parent8d9b39c6499b113ef9218c80682de114beffe7bb (diff)
parent7e1da86339f29e445e40d41132c30741df8c19ad (diff)
Merge tag 'iio-fixes-for-4.5a' 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.5 cycle. This set comprises those not dependent on patches in the 4.5 merge cycle. A second set will follow shortly with ones that are. * core in kernel interfaces - fix a possible NULL dereference that is a theoretical possibility via odd usage of iio_channel_release. Pretty much a hardening of the interface, but observed in the wild with the twl4030_charger driver. * acpi-als - report the data as processed as it is in lux. This fixes a wrong use of the IIO ABI. However, old _raw version retained to avoid breaking any userspace in the wild that is relying on that (none known but it doesn't hurt us much to retain it) * ade7753 - fix some error handling to avoid use of unitialized data. * ltr501 - use a signed return type for ltr501_match_samp_freq so as to allow returning of an error code. * mcp4725 - set name field of struct iio_dev to ensure the sysfs name attribute doesn't give NULL. * mpl115 - temperature offset sign is wrong. * stk8ba50 - IIO_TRIGGER dependency added * ti_am335x_adc - Label buffer as a software buffer. It's actually a hybrid of a true hardware buffer feeding a kfifo, but the meaning of these fields has changed a little recently and in this case it should be labeled a software buffer ensure it is allowed to use the kfifo. * vf610_adc - HAS_IOMEM dependency
-rw-r--r--drivers/iio/accel/Kconfig1
-rw-r--r--drivers/iio/adc/Kconfig1
-rw-r--r--drivers/iio/adc/ti_am335x_adc.c2
-rw-r--r--drivers/iio/dac/mcp4725.c1
-rw-r--r--drivers/iio/inkern.c2
-rw-r--r--drivers/iio/light/acpi-als.c6
-rw-r--r--drivers/iio/light/ltr501.c2
-rw-r--r--drivers/iio/pressure/mpl115.c2
-rw-r--r--drivers/staging/iio/meter/ade7753.c12
9 files changed, 22 insertions, 7 deletions
diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index edc29b173f6c..833ea9dd4464 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -213,6 +213,7 @@ config STK8312
213config STK8BA50 213config STK8BA50
214 tristate "Sensortek STK8BA50 3-Axis Accelerometer Driver" 214 tristate "Sensortek STK8BA50 3-Axis Accelerometer Driver"
215 depends on I2C 215 depends on I2C
216 depends on IIO_TRIGGER
216 help 217 help
217 Say yes here to get support for the Sensortek STK8BA50 3-axis 218 Say yes here to get support for the Sensortek STK8BA50 3-axis
218 accelerometer. 219 accelerometer.
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 605ff42c4631..97b20aa0b36c 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -409,6 +409,7 @@ config TWL6030_GPADC
409config VF610_ADC 409config VF610_ADC
410 tristate "Freescale vf610 ADC driver" 410 tristate "Freescale vf610 ADC driver"
411 depends on OF 411 depends on OF
412 depends on HAS_IOMEM
412 select IIO_BUFFER 413 select IIO_BUFFER
413 select IIO_TRIGGERED_BUFFER 414 select IIO_TRIGGERED_BUFFER
414 help 415 help
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 942320e32753..c1e05532d437 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -289,7 +289,7 @@ static int tiadc_iio_buffered_hardware_setup(struct iio_dev *indio_dev,
289 goto error_kfifo_free; 289 goto error_kfifo_free;
290 290
291 indio_dev->setup_ops = setup_ops; 291 indio_dev->setup_ops = setup_ops;
292 indio_dev->modes |= INDIO_BUFFER_HARDWARE; 292 indio_dev->modes |= INDIO_BUFFER_SOFTWARE;
293 293
294 return 0; 294 return 0;
295 295
diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
index 43d14588448d..b4dde8315210 100644
--- a/drivers/iio/dac/mcp4725.c
+++ b/drivers/iio/dac/mcp4725.c
@@ -300,6 +300,7 @@ static int mcp4725_probe(struct i2c_client *client,
300 data->client = client; 300 data->client = client;
301 301
302 indio_dev->dev.parent = &client->dev; 302 indio_dev->dev.parent = &client->dev;
303 indio_dev->name = id->name;
303 indio_dev->info = &mcp4725_info; 304 indio_dev->info = &mcp4725_info;
304 indio_dev->channels = &mcp4725_channel; 305 indio_dev->channels = &mcp4725_channel;
305 indio_dev->num_channels = 1; 306 indio_dev->num_channels = 1;
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 80fbbfd76faf..734a0042de0c 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -349,6 +349,8 @@ EXPORT_SYMBOL_GPL(iio_channel_get);
349 349
350void iio_channel_release(struct iio_channel *channel) 350void iio_channel_release(struct iio_channel *channel)
351{ 351{
352 if (!channel)
353 return;
352 iio_device_put(channel->indio_dev); 354 iio_device_put(channel->indio_dev);
353 kfree(channel); 355 kfree(channel);
354} 356}
diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
index 60537ec0c923..53201d99a16c 100644
--- a/drivers/iio/light/acpi-als.c
+++ b/drivers/iio/light/acpi-als.c
@@ -54,7 +54,9 @@ static const struct iio_chan_spec acpi_als_channels[] = {
54 .realbits = 32, 54 .realbits = 32,
55 .storagebits = 32, 55 .storagebits = 32,
56 }, 56 },
57 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), 57 /* _RAW is here for backward ABI compatibility */
58 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
59 BIT(IIO_CHAN_INFO_PROCESSED),
58 }, 60 },
59}; 61};
60 62
@@ -152,7 +154,7 @@ static int acpi_als_read_raw(struct iio_dev *indio_dev,
152 s32 temp_val; 154 s32 temp_val;
153 int ret; 155 int ret;
154 156
155 if (mask != IIO_CHAN_INFO_RAW) 157 if ((mask != IIO_CHAN_INFO_PROCESSED) && (mask != IIO_CHAN_INFO_RAW))
156 return -EINVAL; 158 return -EINVAL;
157 159
158 /* we support only illumination (_ALI) so far. */ 160 /* we support only illumination (_ALI) so far. */
diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 809a961b9a7f..6bf89d8f3741 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -180,7 +180,7 @@ static const struct ltr501_samp_table ltr501_ps_samp_table[] = {
180 {500000, 2000000} 180 {500000, 2000000}
181}; 181};
182 182
183static unsigned int ltr501_match_samp_freq(const struct ltr501_samp_table *tab, 183static int ltr501_match_samp_freq(const struct ltr501_samp_table *tab,
184 int len, int val, int val2) 184 int len, int val, int val2)
185{ 185{
186 int i, freq; 186 int i, freq;
diff --git a/drivers/iio/pressure/mpl115.c b/drivers/iio/pressure/mpl115.c
index f5ecd6e19f5d..a0d7deeac62f 100644
--- a/drivers/iio/pressure/mpl115.c
+++ b/drivers/iio/pressure/mpl115.c
@@ -117,7 +117,7 @@ static int mpl115_read_raw(struct iio_dev *indio_dev,
117 *val = ret >> 6; 117 *val = ret >> 6;
118 return IIO_VAL_INT; 118 return IIO_VAL_INT;
119 case IIO_CHAN_INFO_OFFSET: 119 case IIO_CHAN_INFO_OFFSET:
120 *val = 605; 120 *val = -605;
121 *val2 = 750000; 121 *val2 = 750000;
122 return IIO_VAL_INT_PLUS_MICRO; 122 return IIO_VAL_INT_PLUS_MICRO;
123 case IIO_CHAN_INFO_SCALE: 123 case IIO_CHAN_INFO_SCALE:
diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
index f129039bece3..69287108f793 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -217,8 +217,12 @@ error_ret:
217static int ade7753_reset(struct device *dev) 217static int ade7753_reset(struct device *dev)
218{ 218{
219 u16 val; 219 u16 val;
220 int ret;
221
222 ret = ade7753_spi_read_reg_16(dev, ADE7753_MODE, &val);
223 if (ret)
224 return ret;
220 225
221 ade7753_spi_read_reg_16(dev, ADE7753_MODE, &val);
222 val |= BIT(6); /* Software Chip Reset */ 226 val |= BIT(6); /* Software Chip Reset */
223 227
224 return ade7753_spi_write_reg_16(dev, ADE7753_MODE, val); 228 return ade7753_spi_write_reg_16(dev, ADE7753_MODE, val);
@@ -343,8 +347,12 @@ error_ret:
343static int ade7753_stop_device(struct device *dev) 347static int ade7753_stop_device(struct device *dev)
344{ 348{
345 u16 val; 349 u16 val;
350 int ret;
351
352 ret = ade7753_spi_read_reg_16(dev, ADE7753_MODE, &val);
353 if (ret)
354 return ret;
346 355
347 ade7753_spi_read_reg_16(dev, ADE7753_MODE, &val);
348 val |= BIT(4); /* AD converters can be turned off */ 356 val |= BIT(4); /* AD converters can be turned off */
349 357
350 return ade7753_spi_write_reg_16(dev, ADE7753_MODE, val); 358 return ade7753_spi_write_reg_16(dev, ADE7753_MODE, val);