Commit a2f28355 authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron

iio: adc: at91-sama5d2_adc: use devm_iio_triggered_buffer_setup_ext()

This change switches to the new devm_iio_triggered_buffer_setup_ext()
function and removes the iio_buffer_set_attrs() call, for assigning the
HW FIFO attributes to the buffer.
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200929125949.69934-7-alexandru.ardelean@analog.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 1864c829
...@@ -1673,11 +1673,17 @@ static int at91_adc_buffer_and_trigger_init(struct device *dev, ...@@ -1673,11 +1673,17 @@ static int at91_adc_buffer_and_trigger_init(struct device *dev,
struct iio_dev *indio) struct iio_dev *indio)
{ {
struct at91_adc_state *st = iio_priv(indio); struct at91_adc_state *st = iio_priv(indio);
const struct attribute **fifo_attrs;
int ret; int ret;
ret = devm_iio_triggered_buffer_setup(&indio->dev, indio, if (st->selected_trig->hw_trig)
fifo_attrs = at91_adc_fifo_attributes;
else
fifo_attrs = NULL;
ret = devm_iio_triggered_buffer_setup_ext(&indio->dev, indio,
&iio_pollfunc_store_time, &iio_pollfunc_store_time,
&at91_adc_trigger_handler, &at91_buffer_setup_ops); &at91_adc_trigger_handler, &at91_buffer_setup_ops, fifo_attrs);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "couldn't initialize the buffer.\n"); dev_err(dev, "couldn't initialize the buffer.\n");
return ret; return ret;
...@@ -1686,8 +1692,6 @@ static int at91_adc_buffer_and_trigger_init(struct device *dev, ...@@ -1686,8 +1692,6 @@ static int at91_adc_buffer_and_trigger_init(struct device *dev,
if (!st->selected_trig->hw_trig) if (!st->selected_trig->hw_trig)
return 0; return 0;
iio_buffer_set_attrs(indio->buffer, at91_adc_fifo_attributes);
st->trig = at91_adc_allocate_trigger(indio, st->selected_trig->name); st->trig = at91_adc_allocate_trigger(indio, st->selected_trig->name);
if (IS_ERR(st->trig)) { if (IS_ERR(st->trig)) {
dev_err(dev, "could not allocate trigger\n"); dev_err(dev, "could not allocate trigger\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment