Skip to content

Commit 1864c82

Browse files
commodoJonathan Cameron
authored andcommitted
iio: accel: bmc150: use iio_triggered_buffer_setup_ext()
This change switches to the new 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-6-alexandru.ardelean@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent abef6bc commit 1864c82

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

‎drivers/iio/accel/bmc150-accel-core.c‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,7 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data)
15581558
int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
15591559
const char *name, bool block_supported)
15601560
{
1561+
const struct attribute **fifo_attrs;
15611562
struct bmc150_accel_data *data;
15621563
struct iio_dev *indio_dev;
15631564
int ret;
@@ -1590,10 +1591,19 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
15901591
indio_dev->modes = INDIO_DIRECT_MODE;
15911592
indio_dev->info = &bmc150_accel_info;
15921593

1593-
ret = iio_triggered_buffer_setup(indio_dev,
1594-
&iio_pollfunc_store_time,
1595-
bmc150_accel_trigger_handler,
1596-
&bmc150_accel_buffer_ops);
1594+
if (block_supported) {
1595+
indio_dev->modes |= INDIO_BUFFER_SOFTWARE;
1596+
indio_dev->info = &bmc150_accel_info_fifo;
1597+
fifo_attrs = bmc150_accel_fifo_attributes;
1598+
} else {
1599+
fifo_attrs = NULL;
1600+
}
1601+
1602+
ret = iio_triggered_buffer_setup_ext(indio_dev,
1603+
&iio_pollfunc_store_time,
1604+
bmc150_accel_trigger_handler,
1605+
&bmc150_accel_buffer_ops,
1606+
fifo_attrs);
15971607
if (ret < 0) {
15981608
dev_err(dev, "Failed: iio triggered buffer setup\n");
15991609
return ret;
@@ -1628,13 +1638,6 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
16281638
ret = bmc150_accel_triggers_setup(indio_dev, data);
16291639
if (ret)
16301640
goto err_buffer_cleanup;
1631-
1632-
if (block_supported) {
1633-
indio_dev->modes |= INDIO_BUFFER_SOFTWARE;
1634-
indio_dev->info = &bmc150_accel_info_fifo;
1635-
iio_buffer_set_attrs(indio_dev->buffer,
1636-
bmc150_accel_fifo_attributes);
1637-
}
16381641
}
16391642

16401643
ret = pm_runtime_set_active(dev);

0 commit comments

Comments
 (0)