staging:iio: Use iio_buffer_enabled instead of open coding it

Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Lars-Peter Clausen 2011-12-19 15:23:42 +01:00 committed by Greg Kroah-Hartman
parent 0ae3a912d8
commit d4a6882e1b
1 changed files with 2 additions and 3 deletions

View File

@ -420,7 +420,7 @@ ssize_t iio_buffer_store_enable(struct device *dev,
mutex_lock(&indio_dev->mlock);
previous_mode = indio_dev->currentmode;
requested_state = !(buf[0] == '0');
current_state = !!(previous_mode & INDIO_ALL_BUFFER_MODES);
current_state = iio_buffer_enabled(indio_dev);
if (current_state == requested_state) {
printk(KERN_INFO "iio-buffer, current state requested again\n");
goto done;
@ -509,8 +509,7 @@ ssize_t iio_buffer_show_enable(struct device *dev,
char *buf)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", !!(indio_dev->currentmode
& INDIO_ALL_BUFFER_MODES));
return sprintf(buf, "%d\n", iio_buffer_enabled(indio_dev));
}
EXPORT_SYMBOL(iio_buffer_show_enable);