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:
@@ -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
|
||||
|
||||
@@ -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 @@ err_dev:
|
||||
mxs_lradc_trigger_remove(iio);
|
||||
err_trig:
|
||||
iio_triggered_buffer_cleanup(iio);
|
||||
err_clk:
|
||||
clk_disable_unprepare(lradc->clk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user