Skip to content

Commit 9dd4694

Browse files
Josselin Costanzijic23
authored andcommitted
iio: staging: sca3000: hide stufftoread logic
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>
1 parent f1b07cd commit 9dd4694

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎drivers/iio/industrialio-buffer.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ static bool iio_buffer_is_active(struct iio_buffer *buf)
3939

4040
static bool iio_buffer_data_available(struct iio_buffer *buf)
4141
{
42-
if (buf->access->data_available)
43-
return buf->access->data_available(buf);
44-
45-
return buf->stufftoread;
42+
return buf->access->data_available(buf);
4643
}
4744

4845
/**

‎drivers/staging/iio/accel/sca3000_ring.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ static int sca3000_ring_get_bytes_per_datum(struct iio_buffer *r)
141141
return 6;
142142
}
143143

144+
static bool sca3000_ring_buf_data_available(struct iio_buffer *r)
145+
{
146+
return r->stufftoread;
147+
}
148+
144149
static IIO_BUFFER_ENABLE_ATTR;
145150
static IIO_BUFFER_LENGTH_ATTR;
146151

@@ -274,6 +279,7 @@ static const struct iio_buffer_access_funcs sca3000_ring_access_funcs = {
274279
.read_first_n = &sca3000_read_first_n_hw_rb,
275280
.get_length = &sca3000_ring_get_length,
276281
.get_bytes_per_datum = &sca3000_ring_get_bytes_per_datum,
282+
.data_available = sca3000_ring_buf_data_available,
277283
.release = sca3000_ring_release,
278284
};
279285

0 commit comments

Comments
 (0)