Skip to content

Commit a2f2835

Browse files
commodoJonathan Cameron
authored andcommitted
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>
1 parent 1864c82 commit a2f2835

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎drivers/iio/adc/at91-sama5d2_adc.c‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,11 +1673,17 @@ static int at91_adc_buffer_and_trigger_init(struct device *dev,
16731673
struct iio_dev *indio)
16741674
{
16751675
struct at91_adc_state *st = iio_priv(indio);
1676+
const struct attribute **fifo_attrs;
16761677
int ret;
16771678

1678-
ret = devm_iio_triggered_buffer_setup(&indio->dev, indio,
1679+
if (st->selected_trig->hw_trig)
1680+
fifo_attrs = at91_adc_fifo_attributes;
1681+
else
1682+
fifo_attrs = NULL;
1683+
1684+
ret = devm_iio_triggered_buffer_setup_ext(&indio->dev, indio,
16791685
&iio_pollfunc_store_time,
1680-
&at91_adc_trigger_handler, &at91_buffer_setup_ops);
1686+
&at91_adc_trigger_handler, &at91_buffer_setup_ops, fifo_attrs);
16811687
if (ret < 0) {
16821688
dev_err(dev, "couldn't initialize the buffer.\n");
16831689
return ret;
@@ -1686,8 +1692,6 @@ static int at91_adc_buffer_and_trigger_init(struct device *dev,
16861692
if (!st->selected_trig->hw_trig)
16871693
return 0;
16881694

1689-
iio_buffer_set_attrs(indio->buffer, at91_adc_fifo_attributes);
1690-
16911695
st->trig = at91_adc_allocate_trigger(indio, st->selected_trig->name);
16921696
if (IS_ERR(st->trig)) {
16931697
dev_err(dev, "could not allocate trigger\n");

0 commit comments

Comments
 (0)