summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorAlexandru Ardelean <alexandru.ardelean@analog.com>2020-09-29 15:59:46 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-11-21 14:53:24 +0000
commita2f283555b86c3f43651af2875ddbcb17c78091f (patch)
tree8a3f30f20906fd8b0fa37c24c07e768c1b16c992 /drivers/iio
parent1864c829c91e8c65b0eba2f822ee66f227e29bcb (diff)
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: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20200929125949.69934-7-alexandru.ardelean@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/at91-sama5d2_adc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index 04767cd0ce8b..6edcc99009d1 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -1673,11 +1673,17 @@ static int at91_adc_buffer_and_trigger_init(struct device *dev,
struct iio_dev *indio)
{
struct at91_adc_state *st = iio_priv(indio);
+ const struct attribute **fifo_attrs;
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,
- &at91_adc_trigger_handler, &at91_buffer_setup_ops);
+ &at91_adc_trigger_handler, &at91_buffer_setup_ops, fifo_attrs);
if (ret < 0) {
dev_err(dev, "couldn't initialize the buffer.\n");
return ret;
@@ -1686,8 +1692,6 @@ static int at91_adc_buffer_and_trigger_init(struct device *dev,
if (!st->selected_trig->hw_trig)
return 0;
- iio_buffer_set_attrs(indio->buffer, at91_adc_fifo_attributes);
-
st->trig = at91_adc_allocate_trigger(indio, st->selected_trig->name);
if (IS_ERR(st->trig)) {
dev_err(dev, "could not allocate trigger\n");