mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-07-01 23:53:16 -04:00
iio: buffer: wrap all buffer attributes into iio_dev_attr
This change wraps all buffer attributes into iio_dev_attr objects, and assigns a reference to the IIO buffer they belong to. With the addition of multiple IIO buffers per one IIO device, we need a way to know which IIO buffer is being enabled/disabled/controlled. We know that all buffer attributes are device_attributes. So we can wrap them with a iio_dev_attr types. In the iio_dev_attr type, we can also hold a reference to an IIO buffer. So, we end up being able to allocate wrapped attributes for all buffer attributes (even the one from other drivers). The neat part with this mechanism, is that we don't need to add any extra cleanup, because these attributes are being added to a dynamic list that will get cleaned up via iio_free_chan_devattr_list(). With this change, the 'buffer->scan_el_dev_attr_list' list is being renamed to 'buffer->buffer_attr_list', effectively merging (or finalizing the merge) of the buffer/ & scan_elements/ attributes internally. Accessing these new buffer attributes can now be done via 'to_iio_dev_attr(attr)->buffer' inside the show/store handlers. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210215104043.91251-15-alexandru.ardelean@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
3e3d11b2e4
commit
15097c7a1a
3 changed files with 54 additions and 29 deletions
|
@ -97,8 +97,8 @@ struct iio_buffer {
|
|||
/* @scan_timestamp: Does the scan mode include a timestamp. */
|
||||
bool scan_timestamp;
|
||||
|
||||
/* @scan_el_dev_attr_list: List of scan element related attributes. */
|
||||
struct list_head scan_el_dev_attr_list;
|
||||
/* @buffer_attr_list: List of buffer attributes. */
|
||||
struct list_head buffer_attr_list;
|
||||
|
||||
/*
|
||||
* @buffer_group: Attributes of the new buffer group.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue