Skip to content

Commit

Permalink
iio: staging: sca3000: hide stufftoread logic
Browse files Browse the repository at this point in the history
Change sca3000_ring implementation so that it exports a data_available
function to iio.

Signed-off-by: Josselin Costanzi <josselin.costanzi@mobile-devices.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Josselin Costanzi authored and Jonathan Cameron committed Jun 29, 2014
1 parent f1b07cd commit 9dd4694
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/iio/industrialio-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ static bool iio_buffer_is_active(struct iio_buffer *buf)

static bool iio_buffer_data_available(struct iio_buffer *buf)
{
if (buf->access->data_available)
return buf->access->data_available(buf);

return buf->stufftoread;
return buf->access->data_available(buf);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions drivers/staging/iio/accel/sca3000_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ static int sca3000_ring_get_bytes_per_datum(struct iio_buffer *r)
return 6;
}

static bool sca3000_ring_buf_data_available(struct iio_buffer *r)
{
return r->stufftoread;
}

static IIO_BUFFER_ENABLE_ATTR;
static IIO_BUFFER_LENGTH_ATTR;

Expand Down Expand Up @@ -274,6 +279,7 @@ static const struct iio_buffer_access_funcs sca3000_ring_access_funcs = {
.read_first_n = &sca3000_read_first_n_hw_rb,
.get_length = &sca3000_ring_get_length,
.get_bytes_per_datum = &sca3000_ring_get_bytes_per_datum,
.data_available = sca3000_ring_buf_data_available,
.release = sca3000_ring_release,
};

Expand Down

0 comments on commit 9dd4694

Please sign in to comment.