OSDN Git Service

iio: triggered-buffer: add {devm_}iio_triggered_buffer_setup_ext variants
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Tue, 29 Sep 2020 12:59:43 +0000 (15:59 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 21 Nov 2020 14:53:09 +0000 (14:53 +0000)
commit5164c788985702ad94fa4ce6adca29bf280876df
tree308d9e05c0f7202959138f3ed8a9aea0363a1f86
parent789976accb6a7b93226fcf8441ffc95edff3d371
iio: triggered-buffer: add {devm_}iio_triggered_buffer_setup_ext variants

This change adds a parameter to the {devm_}iio_triggered_buffer_setup()
functions to assign the extra sysfs buffer attributes that are typically
assigned via iio_buffer_set_attrs().

The functions also get renamed to iio_triggered_buffer_setup_ext() &
devm_iio_triggered_buffer_setup_ext().
For backwards compatibility the old {devm_}iio_triggered_buffer_setup()
functions are now macros wrap the new (renamed) functions with NULL for the
buffer attrs.

The aim is to remove iio_buffer_set_attrs(), so in the
iio_triggered_buffer_setup_ext() function the attributes are assigned
directly to 'buffer->attrs'.

When adding multiple IIO buffers per IIO device, it can be pretty
cumbersome to first allocate a set of buffers, then to dig them out of IIO
to assign extra attributes (with iio_buffer_set_attrs()).

Naturally, the best way would be to provide them at allocation time, which
is what this change does.

At this moment, buffers allocated with {devm_}iio_triggered_buffer_setup()
are the only ones in mainline IIO to call iio_buffer_set_attrs().

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-4-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/buffer/industrialio-triggered-buffer.c
include/linux/iio/triggered_buffer.h