First round of IIO fixes for the 3.18 cycle.

* ad5933 - fix a null pointer dereference due to an old change that prevents
   different channels being registered for the buffer and used for sysfs
   interfaces.
 * ad5933 - Drop a bonus _raw from attribute names.
 * st-sensors - Makes sure the correct number of elements are copied when
   filling a local buffer copy.
 * mxs-lradc - Disable clocks in a failure path during probe so they aren't
   left running.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJUPWESAAoJEFSFNJnE9BaI/TAP/2EZp7NR+k3CRZVRLuXxeSrD
 voMS3zNtYMC2E56W0l89gOZdR4rCXzJlhUdRHcGkl7qw1r6stjEBMKIJmd3NVEc4
 dOZ4tCsb/kTmF+66QitL73ioZqoLMrpaGubf8l10t8V3wSsOqnf3wYUftGcdl4NK
 uXAIDmUYgAm4zUUZCKE95o2Npkotm5ftRQqgdChuK7vGVJikN8blzRDokGcZTAh6
 CR04tktxhkg/E+Nq67h9zXPnMOTbw4onNGKD3cztGKZ2bBN+4W/ywEnUrTOu35Eg
 zKMkwYnlBKMTOkTwzml4izHlZw/yFXTXHSPwm1a2fxcVuLuGUBuxX5Pa+kCpLOJo
 2aewUhnwlXhvCrDcFq/rTeqUsOV8mfZxuxqVOQ/utbyUgX5LtHCgQ8aPf0GBbty7
 l8SzxTkCXyogUc4PbNh8DqqksKGkMn/AtC3MfWeEvAYdCZpMXROb4RTAAMVvqytl
 34DMKVaRUy8eiUfcJ+8cH9LvH3Gri7OIbXeLD7iatZ7anaXlQB/EzjTc8yw7+t+C
 EBa7s90XhbRCkE5cadZm76deSscyGgX1cCQS6eStzn1AF0LY/Cj1KMkkJjtFFN31
 Cc7SOAa7rY0BwotwVRV5id4tihyxU9b/Dxi1StoioP4Rjp0B3Y9WsN+EuvPGjFYo
 4JrfV0JYhHktQF+rEmM0
 =TYUO
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First round of IIO fixes for the 3.18 cycle.

* ad5933 - fix a null pointer dereference due to an old change that prevents
  different channels being registered for the buffer and used for sysfs
  interfaces.
* ad5933 - Drop a bonus _raw from attribute names.
* st-sensors - Makes sure the correct number of elements are copied when
  filling a local buffer copy.
* mxs-lradc - Disable clocks in a failure path during probe so they aren't
  left running.
This commit is contained in:
Greg Kroah-Hartman 2014-10-25 10:09:39 +08:00
commit 7e74783a9d
3 changed files with 15 additions and 14 deletions

View File

@ -71,7 +71,7 @@ int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf)
goto st_sensors_free_memory;
}
for (i = 0; i < n * num_data_channels; i++) {
for (i = 0; i < n * byte_for_channel; i++) {
if (i < n)
buf[i] = rx_array[i];
else

View File

@ -1559,14 +1559,16 @@ static int mxs_lradc_probe(struct platform_device *pdev)
/* Grab all IRQ sources */
for (i = 0; i < of_cfg->irq_count; i++) {
lradc->irq[i] = platform_get_irq(pdev, i);
if (lradc->irq[i] < 0)
return lradc->irq[i];
if (lradc->irq[i] < 0) {
ret = lradc->irq[i];
goto err_clk;
}
ret = devm_request_irq(dev, lradc->irq[i],
mxs_lradc_handle_irq, 0,
of_cfg->irq_name[i], iio);
if (ret)
return ret;
goto err_clk;
}
lradc->vref_mv = of_cfg->vref_mv;
@ -1588,7 +1590,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
&mxs_lradc_trigger_handler,
&mxs_lradc_buffer_ops);
if (ret)
return ret;
goto err_clk;
ret = mxs_lradc_trigger_init(iio);
if (ret)
@ -1643,6 +1645,8 @@ static int mxs_lradc_probe(struct platform_device *pdev)
mxs_lradc_trigger_remove(iio);
err_trig:
iio_triggered_buffer_cleanup(iio);
err_clk:
clk_disable_unprepare(lradc->clk);
return ret;
}

View File

@ -115,6 +115,7 @@ static const struct iio_chan_spec ad5933_channels[] = {
.channel = 0,
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
.address = AD5933_REG_TEMP_DATA,
.scan_index = -1,
.scan_type = {
.sign = 's',
.realbits = 14,
@ -124,9 +125,7 @@ static const struct iio_chan_spec ad5933_channels[] = {
.type = IIO_VOLTAGE,
.indexed = 1,
.channel = 0,
.extend_name = "real_raw",
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_SCALE),
.extend_name = "real",
.address = AD5933_REG_REAL_DATA,
.scan_index = 0,
.scan_type = {
@ -138,9 +137,7 @@ static const struct iio_chan_spec ad5933_channels[] = {
.type = IIO_VOLTAGE,
.indexed = 1,
.channel = 0,
.extend_name = "imag_raw",
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_SCALE),
.extend_name = "imag",
.address = AD5933_REG_IMAG_DATA,
.scan_index = 1,
.scan_type = {
@ -749,14 +746,14 @@ static int ad5933_probe(struct i2c_client *client,
indio_dev->name = id->name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = ad5933_channels;
indio_dev->num_channels = 1; /* only register temp0_input */
indio_dev->num_channels = ARRAY_SIZE(ad5933_channels);
ret = ad5933_register_ring_funcs_and_init(indio_dev);
if (ret)
goto error_disable_reg;
/* skip temp0_input, register in0_(real|imag)_raw */
ret = iio_buffer_register(indio_dev, &ad5933_channels[1], 2);
ret = iio_buffer_register(indio_dev, ad5933_channels,
ARRAY_SIZE(ad5933_channels));
if (ret)
goto error_unreg_ring;