From: Jonathan Cameron <jic23@cam.ac.uk>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <michael.hennerich@analog.com>,
linux-iio@vger.kernel.org,
device-drivers-devel@blackfin.uclinux.org, drivers@analog.com
Subject: Re: [PATCH 1/4] staging:iio:dac:ad5791: Use correct DAC bit-size
Date: Wed, 19 Oct 2011 13:57:38 +0100 [thread overview]
Message-ID: <4E9EC942.7060305@cam.ac.uk> (raw)
In-Reply-To: <1319027030-9696-1-git-send-email-lars@metafoo.de>
On 10/19/11 13:23, Lars-Peter Clausen wrote:
> Commit c5b99396 ("staging:iio:dac:ad5791 chan spec conversion.") introduced a
> small bug, using storagebits instead of realbits throughout the driver, which
> causes the driver to work incorrectly. This patch fixes it.
oops
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
> drivers/staging/iio/dac/ad5791.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c
> index fbf446d..9a76c43 100644
> --- a/drivers/staging/iio/dac/ad5791.c
> +++ b/drivers/staging/iio/dac/ad5791.c
> @@ -234,11 +234,11 @@ static int ad5791_read_raw(struct iio_dev *indio_dev,
> return ret;
> *val &= AD5791_DAC_MASK;
> *val >>= chan->scan_type.shift;
> - *val -= (1 << (chan->scan_type.storagebits - 1));
> + *val -= (1 << (chan->scan_type.realbits - 1));
> return IIO_VAL_INT;
> case (1 << IIO_CHAN_INFO_SCALE_SHARED):
> *val = 0;
> - *val2 = (st->vref_mv * 1000) >> chan->scan_type.storagebits;
> + *val2 = (st->vref_mv * 1000) >> chan->scan_type.realbits;
> return IIO_VAL_INT_PLUS_MICRO;
> default:
> return -EINVAL;
> @@ -257,8 +257,8 @@ static int ad5791_write_raw(struct iio_dev *indio_dev,
>
> switch (mask) {
> case 0:
> - val += (1 << (chan->scan_type.storagebits - 1));
> - val &= AD5791_RES_MASK(chan->scan_type.storagebits);
> + val += (1 << (chan->scan_type.realbits - 1));
> + val &= AD5791_RES_MASK(chan->scan_type.realbits);
> val <<= chan->scan_type.shift;
>
> return ad5791_spi_write(st->spi, chan->address, val);
next prev parent reply other threads:[~2011-10-19 12:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-19 12:23 [PATCH 1/4] staging:iio:dac:ad5791: Use correct DAC bit-size Lars-Peter Clausen
2011-10-19 12:23 ` [PATCH 2/4] staging:iio:dac:ad5791: Allow asymmetrical reference voltages Lars-Peter Clausen
2011-10-19 13:01 ` Jonathan Cameron
2011-10-19 13:21 ` Lars-Peter Clausen
2011-10-19 13:39 ` Jonathan Cameron
2011-10-19 12:23 ` [PATCH 3/4] staging:iio:dac:ad5791: Convert attributes to new naming spec Lars-Peter Clausen
2011-10-19 13:02 ` Jonathan Cameron
2011-10-19 12:23 ` [PATCH 4/4] staging:iio:dac:ad5791: Fix scale unit Lars-Peter Clausen
2011-10-19 13:03 ` Jonathan Cameron
2011-10-19 12:57 ` Jonathan Cameron [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-10-19 15:47 [PATCH 1/4] staging:iio:dac:ad5791: Use correct DAC bit-size Lars-Peter Clausen
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=4E9EC942.7060305@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=device-drivers-devel@blackfin.uclinux.org \
--cc=drivers@analog.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=michael.hennerich@analog.com \
/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.