Skip to content

Commit 9f46677

Browse files
committed
iio:buffer: Introduced a function to assign the buffer specific attrs.
This is a necessary step in taking the buffer implementation opaque. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
1 parent 263cf5e commit 9f46677

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,8 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
16381638
if (block_supported) {
16391639
indio_dev->modes |= INDIO_BUFFER_SOFTWARE;
16401640
indio_dev->info = &bmc150_accel_info_fifo;
1641-
indio_dev->buffer->attrs = bmc150_accel_fifo_attributes;
1641+
iio_buffer_set_attrs(indio_dev->buffer,
1642+
bmc150_accel_fifo_attributes);
16421643
}
16431644
}
16441645

‎drivers/iio/industrialio-buffer.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,18 @@ void iio_buffer_init(struct iio_buffer *buffer)
209209
}
210210
EXPORT_SYMBOL(iio_buffer_init);
211211

212+
/**
213+
* iio_buffer_set_attrs - Set buffer specific attributes
214+
* @buffer: The buffer for which we are setting attributes
215+
* @attrs: Pointer to a null terminated list of pointers to attributes
216+
*/
217+
void iio_buffer_set_attrs(struct iio_buffer *buffer,
218+
const struct attribute **attrs)
219+
{
220+
buffer->attrs = attrs;
221+
}
222+
EXPORT_SYMBOL_GPL(iio_buffer_set_attrs);
223+
212224
static ssize_t iio_show_scan_index(struct device *dev,
213225
struct device_attribute *attr,
214226
char *buf)

‎include/linux/iio/buffer.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
struct iio_buffer;
1919

20+
void iio_buffer_set_attrs(struct iio_buffer *buffer,
21+
const struct attribute **attrs);
2022
/**
2123
* INDIO_BUFFER_FLAG_FIXED_WATERMARK - Watermark level of the buffer can not be
2224
* configured. It has a fixed value which will be buffer specific.

0 commit comments

Comments
 (0)