Skip to content

Commit

Permalink
Merge tag 'iio-fixes-for-3.18a' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/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.
  • Loading branch information
gregkh committed Oct 25, 2014
2 parents 54d5c5c + 75d7ed3 commit 7e74783
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion drivers/iio/common/st_sensors/st_sensors_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions drivers/staging/iio/adc/mxs-lradc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down
15 changes: 6 additions & 9 deletions drivers/staging/iio/impedance-analyzer/ad5933.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = {
Expand All @@ -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 = {
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 7e74783

Please sign in to comment.