diff options
Diffstat (limited to 'kernel/drivers/staging/iio/accel/sca3000_ring.c')
-rw-r--r-- | kernel/drivers/staging/iio/accel/sca3000_ring.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/kernel/drivers/staging/iio/accel/sca3000_ring.c b/kernel/drivers/staging/iio/accel/sca3000_ring.c index 8589eade1..20b878d35 100644 --- a/kernel/drivers/staging/iio/accel/sca3000_ring.c +++ b/kernel/drivers/staging/iio/accel/sca3000_ring.c @@ -34,9 +34,9 @@ */ static int sca3000_read_data(struct sca3000_state *st, - uint8_t reg_address_high, - u8 **rx_p, - int len) + u8 reg_address_high, + u8 **rx_p, + int len) { int ret; struct spi_transfer xfer[2] = { @@ -106,7 +106,7 @@ static int sca3000_read_first_n_hw_rb(struct iio_buffer *r, * i.e. number of time points * number of channels. */ if (count > num_available * bytes_per_sample) - num_read = num_available*bytes_per_sample; + num_read = num_available * bytes_per_sample; else num_read = count; @@ -116,7 +116,7 @@ static int sca3000_read_first_n_hw_rb(struct iio_buffer *r, if (ret) goto error_ret; - for (i = 0; i < num_read; i++) + for (i = 0; i < num_read / sizeof(u16); i++) *(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i); if (copy_to_user(buf, rx, num_read)) @@ -160,9 +160,9 @@ static ssize_t sca3000_query_ring_int(struct device *dev, * sca3000_set_ring_int() set state of ring status interrupt **/ static ssize_t sca3000_set_ring_int(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct sca3000_state *st = iio_priv(indio_dev); @@ -208,7 +208,7 @@ static ssize_t sca3000_show_buffer_scale(struct device *dev, struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct sca3000_state *st = iio_priv(indio_dev); - return sprintf(buf, "0.%06d\n", 4*st->info->scale); + return sprintf(buf, "0.%06d\n", 4 * st->info->scale); } static IIO_DEVICE_ATTR(in_accel_scale, @@ -258,6 +258,8 @@ static const struct iio_buffer_access_funcs sca3000_ring_access_funcs = { .read_first_n = &sca3000_read_first_n_hw_rb, .data_available = sca3000_ring_buf_data_available, .release = sca3000_ring_release, + + .modes = INDIO_BUFFER_HARDWARE, }; int sca3000_configure_ring(struct iio_dev *indio_dev) @@ -265,7 +267,7 @@ int sca3000_configure_ring(struct iio_dev *indio_dev) struct iio_buffer *buffer; buffer = sca3000_rb_allocate(indio_dev); - if (buffer == NULL) + if (!buffer) return -ENOMEM; indio_dev->modes |= INDIO_BUFFER_HARDWARE; @@ -305,6 +307,7 @@ error_ret: return ret; } + /** * sca3000_hw_ring_preenable() hw ring buffer preenable function * |