Commit 389ac488 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:adc:ad7476 scrap read from buffer for sysfs access.

No known use case and complicates in kernel interface work.
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e0f0ddad
...@@ -54,14 +54,9 @@ struct ad7298_state { ...@@ -54,14 +54,9 @@ struct ad7298_state {
}; };
#ifdef CONFIG_IIO_BUFFER #ifdef CONFIG_IIO_BUFFER
int ad7298_scan_from_ring(struct iio_dev *indio_dev, long ch);
int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev); int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev);
void ad7298_ring_cleanup(struct iio_dev *indio_dev); void ad7298_ring_cleanup(struct iio_dev *indio_dev);
#else /* CONFIG_IIO_BUFFER */ #else /* CONFIG_IIO_BUFFER */
static inline int ad7298_scan_from_ring(struct iio_dev *indio_dev, long ch)
{
return 0;
}
static inline int static inline int
ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev) ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev)
......
...@@ -123,12 +123,8 @@ static int ad7298_read_raw(struct iio_dev *indio_dev, ...@@ -123,12 +123,8 @@ static int ad7298_read_raw(struct iio_dev *indio_dev,
switch (m) { switch (m) {
case 0: case 0:
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
if (iio_buffer_enabled(indio_dev)) { if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
if (chan->address == AD7298_CH_TEMP) ret = -EBUSY;
ret = -ENODEV;
else
ret = ad7298_scan_from_ring(indio_dev,
chan->address);
} else { } else {
if (chan->address == AD7298_CH_TEMP) if (chan->address == AD7298_CH_TEMP)
ret = ad7298_scan_temp(st, val); ret = ad7298_scan_temp(st, val);
......
...@@ -18,35 +18,6 @@ ...@@ -18,35 +18,6 @@
#include "ad7298.h" #include "ad7298.h"
int ad7298_scan_from_ring(struct iio_dev *indio_dev, long ch)
{
struct iio_buffer *ring = indio_dev->buffer;
int ret;
u16 *ring_data;
if (!(test_bit(ch, ring->scan_mask))) {
ret = -EBUSY;
goto error_ret;
}
ring_data = kmalloc(ring->access->get_bytes_per_datum(ring),
GFP_KERNEL);
if (ring_data == NULL) {
ret = -ENOMEM;
goto error_ret;
}
ret = ring->access->read_last(ring, (u8 *) ring_data);
if (ret)
goto error_free_ring_data;
ret = be16_to_cpu(ring_data[ch]);
error_free_ring_data:
kfree(ring_data);
error_ret:
return ret;
}
/** /**
* ad7298_ring_preenable() setup the parameters of the ring before enabling * ad7298_ring_preenable() setup the parameters of the ring before enabling
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment