summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-06-04 11:36:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-05 13:47:32 +0900
commit4468cb552536731fd85f22a367602e9242a55376 (patch)
tree38dda3f6caf2d46452fc2cbf3f13a0669db5c7e6
parent2490594e89c7286585daeaf05a06b6cd7b5c8876 (diff)
downloadop-kernel-dev-4468cb552536731fd85f22a367602e9242a55376.zip
op-kernel-dev-4468cb552536731fd85f22a367602e9242a55376.tar.gz
staging:iio:dac:ad5791: Use strtobool for boolean values
Use strtobool for parsing the powerdown value instead of strict_strtol, since the powerdown attribute is a boolean value. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/iio/dac/ad5791.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c
index 4e955ed9..82b51a7 100644
--- a/drivers/staging/iio/dac/ad5791.c
+++ b/drivers/staging/iio/dac/ad5791.c
@@ -114,25 +114,23 @@ static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan, const char *buf,
size_t len)
{
- long readin;
+ bool pwr_down;
int ret;
struct ad5791_state *st = iio_priv(indio_dev);
- ret = strict_strtol(buf, 10, &readin);
+ ret = strtobool(buf, &pwr_down);
if (ret)
return ret;
- if (readin == 0) {
- st->pwr_down = false;
+ if (!pwr_down) {
st->ctrl &= ~(AD5791_CTRL_OPGND | AD5791_CTRL_DACTRI);
- } else if (readin == 1) {
- st->pwr_down = true;
+ } else {
if (st->pwr_down_mode == AD5791_DAC_PWRDN_6K)
st->ctrl |= AD5791_CTRL_OPGND;
else if (st->pwr_down_mode == AD5791_DAC_PWRDN_3STATE)
st->ctrl |= AD5791_CTRL_DACTRI;
- } else
- ret = -EINVAL;
+ }
+ st->pwr_down = pwr_down;
ret = ad5791_spi_write(st->spi, AD5791_ADDR_CTRL, st->ctrl);
OpenPOWER on IntegriCloud