diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-11-26 20:55:17 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2014-12-12 15:28:34 +0300 |
commit | 374956600ecbedf5ca29c76bde114160eb805091 (patch) | |
tree | 2276389687295dfa2d3704795e6b8a6b1b52257b /drivers/iio/industrialio-buffer.c | |
parent | 8d92db2827b68206f6930e79132243416183e083 (diff) | |
download | linux-374956600ecbedf5ca29c76bde114160eb805091.tar.xz |
iio: buffer: Drop get_length callback
We already do have the length field in the struct iio_buffer which is
expected to be in sync with the current size of the buffer. And currently
all implementations of the get_length callback either return this field or a
constant number.
This patch removes the get_length callback and replaces all occurrences in
the IIO core with directly accessing the length field of the buffer.
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 | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 4ca4c0a09923..2bd8d399f2ec 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -390,11 +390,7 @@ static ssize_t iio_buffer_read_length(struct device *dev, struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct iio_buffer *buffer = indio_dev->buffer; - if (buffer->access->get_length) - return sprintf(buf, "%d\n", - buffer->access->get_length(buffer)); - - return 0; + return sprintf(buf, "%d\n", buffer->length); } static ssize_t iio_buffer_write_length(struct device *dev, @@ -410,9 +406,8 @@ static ssize_t iio_buffer_write_length(struct device *dev, if (ret) return ret; - if (buffer->access->get_length) - if (val == buffer->access->get_length(buffer)) - return len; + if (val == buffer->length) + return len; mutex_lock(&indio_dev->mlock); if (iio_buffer_is_active(indio_dev->buffer)) { |