aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@kernel.org>2012-04-21 05:09:32 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-24 14:23:36 -0400
commita714af276f5002b44e97a2d6d03f85bdae627c41 (patch)
treeebe4ed3caaa001030ebace76d60e98a1690321a6
parent1f9e349460389963838aa5428425e7dc31000af6 (diff)
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>
-rw-r--r--drivers/staging/iio/industrialio-buffer.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/staging/iio/industrialio-buffer.c b/drivers/staging/iio/industrialio-buffer.c
index 386ba760f3f1..59b0caf5deab 100644
--- a/drivers/staging/iio/industrialio-buffer.c
+++ b/drivers/staging/iio/industrialio-buffer.c
@@ -124,13 +124,15 @@ static ssize_t iio_scan_el_store(struct device *dev,
124 const char *buf, 124 const char *buf,
125 size_t len) 125 size_t len)
126{ 126{
127 int ret = 0; 127 int ret;
128 bool state; 128 bool state;
129 struct iio_dev *indio_dev = dev_get_drvdata(dev); 129 struct iio_dev *indio_dev = dev_get_drvdata(dev);
130 struct iio_buffer *buffer = indio_dev->buffer; 130 struct iio_buffer *buffer = indio_dev->buffer;
131 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 131 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
132 132
133 state = !(buf[0] == '0'); 133 ret = strtobool(buf, &state);
134 if (ret < 0)
135 return ret;
134 mutex_lock(&indio_dev->mlock); 136 mutex_lock(&indio_dev->mlock);
135 if (iio_buffer_enabled(indio_dev)) { 137 if (iio_buffer_enabled(indio_dev)) {
136 ret = -EBUSY; 138 ret = -EBUSY;
@@ -169,11 +171,14 @@ static ssize_t iio_scan_el_ts_store(struct device *dev,
169 const char *buf, 171 const char *buf,
170 size_t len) 172 size_t len)
171{ 173{
172 int ret = 0; 174 int ret;
173 struct iio_dev *indio_dev = dev_get_drvdata(dev); 175 struct iio_dev *indio_dev = dev_get_drvdata(dev);
174 bool state; 176 bool state;
175 177
176 state = !(buf[0] == '0'); 178 ret = strtobool(buf, &state);
179 if (ret < 0)
180 return ret;
181
177 mutex_lock(&indio_dev->mlock); 182 mutex_lock(&indio_dev->mlock);
178 if (iio_buffer_enabled(indio_dev)) { 183 if (iio_buffer_enabled(indio_dev)) {
179 ret = -EBUSY; 184 ret = -EBUSY;