Skip to content

Commit

Permalink
staging:iio:dac:ad5504: Use strtobool for boolean values
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
larsclausen authored and gregkh committed Jun 5, 2012
1 parent 159fe69 commit 3bbbf15
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/staging/iio/dac/ad5504.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down

0 comments on commit 3bbbf15

Please sign in to comment.