iio:buffer: Introduced a function to assign the buffer specific attrs.
authorJonathan Cameron <jic23@kernel.org>
Mon, 2 Jan 2017 19:28:26 +0000 (19:28 +0000)
committerJonathan Cameron <jic23@kernel.org>
Tue, 10 Jan 2017 19:54:50 +0000 (19:54 +0000)
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>
drivers/iio/accel/bmc150-accel-core.c
drivers/iio/industrialio-buffer.c
include/linux/iio/buffer.h

index 59b380dbf27f918297d83bd00ae585149baba5a2..6b5d3be283c4e7e00f72bb32e550b52ab06e1526 100644 (file)
@@ -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);
                }
        }
 
index 9f496eb84e0b5c5a9640016fd6c2459b1f9900f0..831537cc95008c9d2fdc437bc7853f8c2d67d79d 100644 (file)
@@ -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)
index 4a65a7bb40a45ffed48e4e69e0abf365f93b0e46..30ea9806db679248813801baeffe3fc284bf448f 100644 (file)
@@ -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.