diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-06-04 11:36:22 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-05 13:47:32 +0900 |
commit | 3bbbf150ffde2ca48249537d2d9e4b52bc0a5fc8 (patch) | |
tree | d693f14402e2a79dd9019bb606df5d57cada1094 | |
parent | 159fe695ae2ad53b915465f30ddd0fbc7f014900 (diff) | |
download | op-kernel-dev-3bbbf150ffde2ca48249537d2d9e4b52bc0a5fc8.zip op-kernel-dev-3bbbf150ffde2ca48249537d2d9e4b52bc0a5fc8.tar.gz |
staging:iio:dac:ad5504: 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/ad5504.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c index 331b536..220150d 100644 --- a/drivers/staging/iio/dac/ad5504.c +++ b/drivers/staging/iio/dac/ad5504.c @@ -147,20 +147,18 @@ static ssize_t ad5504_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 ad5504_state *st = iio_priv(indio_dev); - ret = strict_strtol(buf, 10, &readin); + ret = strtobool(buf, &pwr_down); if (ret) return ret; - if (readin == 0) + if (pwr_down) st->pwr_down_mask |= (1 << chan->channel); - else if (readin == 1) - st->pwr_down_mask &= ~(1 << chan->channel); else - ret = -EINVAL; + st->pwr_down_mask &= ~(1 << chan->channel); ret = ad5504_spi_write(st->spi, AD5504_ADDR_CTRL, AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) | |