Skip to content

Commit

Permalink
iio:buffer: Introduced a function to assign the buffer specific attrs.
Browse files Browse the repository at this point in the history
This is a necessary step in taking the buffer implementation
opaque.

Signed-off-by: Jonathan Cameron <[email protected]>
Reviewed-by: Lars-Peter Clausen <[email protected]>
  • Loading branch information
jic23 committed Jan 10, 2017
1 parent 263cf5e commit 9f46677
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iio/accel/bmc150-accel-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,8 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
if (block_supported) {
indio_dev->modes |= INDIO_BUFFER_SOFTWARE;
indio_dev->info = &bmc150_accel_info_fifo;
indio_dev->buffer->attrs = bmc150_accel_fifo_attributes;
iio_buffer_set_attrs(indio_dev->buffer,
bmc150_accel_fifo_attributes);
}
}

Expand Down
12 changes: 12 additions & 0 deletions drivers/iio/industrialio-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,18 @@ void iio_buffer_init(struct iio_buffer *buffer)
}
EXPORT_SYMBOL(iio_buffer_init);

/**
* iio_buffer_set_attrs - Set buffer specific attributes
* @buffer: The buffer for which we are setting attributes
* @attrs: Pointer to a null terminated list of pointers to attributes
*/
void iio_buffer_set_attrs(struct iio_buffer *buffer,
const struct attribute **attrs)
{
buffer->attrs = attrs;
}
EXPORT_SYMBOL_GPL(iio_buffer_set_attrs);

static ssize_t iio_show_scan_index(struct device *dev,
struct device_attribute *attr,
char *buf)
Expand Down
2 changes: 2 additions & 0 deletions include/linux/iio/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

struct iio_buffer;

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

0 comments on commit 9f46677

Please sign in to comment.