All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/3] staging:iio:dac:ad5504: Use strtobool for boolean values
Date: Tue, 15 May 2012 08:54:25 +0100	[thread overview]
Message-ID: <4FB20BB1.3000404@cam.ac.uk> (raw)
In-Reply-To: <1337068365-23971-1-git-send-email-lars@metafoo.de>

On 5/15/2012 8:52 AM, Lars-Peter Clausen wrote:
> 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>
> ---
>   drivers/staging/iio/dac/ad5504.c |   10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c
> index 25a04d3..6ccf178 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) |


      parent reply	other threads:[~2012-05-15  7:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15  7:52 [PATCH 1/3] staging:iio:dac:ad5504: Use strtobool for boolean values Lars-Peter Clausen
2012-05-15  7:52 ` [PATCH 2/3] staging:iio:dac:ad5624r: " Lars-Peter Clausen
2012-05-15  7:54   ` Jonathan Cameron
2012-05-15  7:52 ` [PATCH 3/3] staging:iio:dac:ad5791: " Lars-Peter Clausen
2012-05-15  7:54   ` Jonathan Cameron
2012-05-15  7:54 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FB20BB1.3000404@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.