diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-10-13 18:10:26 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-10-25 13:51:11 +0000 |
commit | b440655b896b2d5a2fb5f918801fb0e281a537cd (patch) | |
tree | 7a576b45c21d5856bc189c2e5aaa099a5a74723f /drivers/iio/industrialio-buffer.c | |
parent | 4a60535726d90bfad16b5c52dcffaeede9fb84a9 (diff) | |
download | talos-obmc-linux-b440655b896b2d5a2fb5f918801fb0e281a537cd.tar.gz talos-obmc-linux-b440655b896b2d5a2fb5f918801fb0e281a537cd.zip |
iio: Add support for indicating fixed watermarks
For buffers which have a fixed wake-up watermark the watermark attribute
should be read-only. Add a new FIXED_WATERMARK flag to the
struct iio_buffer_access_funcs, which can be set by a buffer
implementation.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/industrialio-buffer.c')
-rw-r--r-- | drivers/iio/industrialio-buffer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 5f2c8c8c436e..98a6447a61d3 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -998,6 +998,8 @@ static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, iio_buffer_show_enable, iio_buffer_store_enable); static DEVICE_ATTR(watermark, S_IRUGO | S_IWUSR, iio_buffer_show_watermark, iio_buffer_store_watermark); +static struct device_attribute dev_attr_watermark_ro = __ATTR(watermark, + S_IRUGO, iio_buffer_show_watermark, NULL); static struct attribute *iio_buffer_attrs[] = { &dev_attr_length.attr, @@ -1040,6 +1042,9 @@ int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev) if (!buffer->access->set_length) attr[0] = &dev_attr_length_ro.attr; + if (buffer->access->flags & INDIO_BUFFER_FLAG_FIXED_WATERMARK) + attr[2] = &dev_attr_watermark_ro.attr; + if (buffer->attrs) memcpy(&attr[ARRAY_SIZE(iio_buffer_attrs)], buffer->attrs, sizeof(struct attribute *) * attrcount); |