1
0
Fork 0

staging:iio:buffer trivial use of strtobool to remove dodgy equivalent.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
hifive-unleashed-5.1
Jonathan Cameron 2012-04-21 10:09:32 +01:00 committed by Greg Kroah-Hartman
parent 1f9e349460
commit a714af276f
1 changed files with 9 additions and 4 deletions

View File

@ -124,13 +124,15 @@ static ssize_t iio_scan_el_store(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
int ret = 0; int ret;
bool state; bool state;
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct iio_buffer *buffer = indio_dev->buffer; struct iio_buffer *buffer = indio_dev->buffer;
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
state = !(buf[0] == '0'); ret = strtobool(buf, &state);
if (ret < 0)
return ret;
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
if (iio_buffer_enabled(indio_dev)) { if (iio_buffer_enabled(indio_dev)) {
ret = -EBUSY; ret = -EBUSY;
@ -169,11 +171,14 @@ static ssize_t iio_scan_el_ts_store(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
int ret = 0; int ret;
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
bool state; bool state;
state = !(buf[0] == '0'); ret = strtobool(buf, &state);
if (ret < 0)
return ret;
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
if (iio_buffer_enabled(indio_dev)) { if (iio_buffer_enabled(indio_dev)) {
ret = -EBUSY; ret = -EBUSY;