From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 08/15] staging:iio:adis16260: Simplify calibscale and caliboffset reading
Date: Sat, 27 Jul 2013 13:00:34 +0100 [thread overview]
Message-ID: <51F3B662.7070105@kernel.org> (raw)
In-Reply-To: <1374072279-7140-8-git-send-email-lars@metafoo.de>
On 07/17/13 15:44, Lars-Peter Clausen wrote:
> All channels for this device have the same number of bits for calibscale and
> caliboffset, there is no need to determine it dynamically based on the channel
> type. Also there is no locking required since adis_read_reg_16() will take care
> of proper locking on its own.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to the togreg branch of iio.git
Thanks
> ---
> drivers/staging/iio/gyro/adis16260_core.c | 31 +++++--------------------------
> 1 file changed, 5 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c
> index f060452..c70094f 100644
> --- a/drivers/staging/iio/gyro/adis16260_core.c
> +++ b/drivers/staging/iio/gyro/adis16260_core.c
> @@ -222,7 +222,6 @@ static int adis16260_read_raw(struct iio_dev *indio_dev,
> {
> struct adis *adis = iio_priv(indio_dev);
> int ret;
> - int bits;
> u8 addr;
> s16 val16;
>
> @@ -263,40 +262,20 @@ static int adis16260_read_raw(struct iio_dev *indio_dev,
> *val = 250000 / 1453; /* 25 C = 0x00 */
> return IIO_VAL_INT;
> case IIO_CHAN_INFO_CALIBBIAS:
> - switch (chan->type) {
> - case IIO_ANGL_VEL:
> - bits = 12;
> - break;
> - default:
> - return -EINVAL;
> - }
> - mutex_lock(&indio_dev->mlock);
> addr = adis16260_addresses[chan->scan_index][0];
> ret = adis_read_reg_16(adis, addr, &val16);
> - if (ret) {
> - mutex_unlock(&indio_dev->mlock);
> + if (ret)
> return ret;
> - }
> - *val = sign_extend32(val16, bits - 1);
> - mutex_unlock(&indio_dev->mlock);
> +
> + *val = sign_extend32(val16, 11);
> return IIO_VAL_INT;
> case IIO_CHAN_INFO_CALIBSCALE:
> - switch (chan->type) {
> - case IIO_ANGL_VEL:
> - bits = 12;
> - break;
> - default:
> - return -EINVAL;
> - }
> - mutex_lock(&indio_dev->mlock);
> addr = adis16260_addresses[chan->scan_index][1];
> ret = adis_read_reg_16(adis, addr, &val16);
> - if (ret) {
> - mutex_unlock(&indio_dev->mlock);
> + if (ret)
> return ret;
> - }
> +
> *val = val16;
> - mutex_unlock(&indio_dev->mlock);
> return IIO_VAL_INT;
> }
> return -EINVAL;
>
next prev parent reply other threads:[~2013-07-27 11:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 14:44 [PATCH 01/15] staging:iio:adis16260: Fix reading calibscale Lars-Peter Clausen
2013-07-17 14:44 ` [PATCH 02/15] staging:iio:adis16260: Drop unused 'negate' property Lars-Peter Clausen
2013-07-27 11:54 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 03/15] staging:iio:adis16260: Remove support for orientation mapping Lars-Peter Clausen
2013-07-20 9:28 ` Jonathan Cameron
2013-07-27 11:55 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 04/15] staging:iio:adis16260: Don't set default scan mask Lars-Peter Clausen
2013-07-27 11:56 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 05/15] staging:iio:adis16260: Remove separate header Lars-Peter Clausen
2013-07-27 11:59 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 06/15] staging:iio:adis16260: Add value range check for calibscale/-bias Lars-Peter Clausen
2013-07-27 11:58 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 07/15] staging:iio:adis16260: Use sign_extend32() instead of open-coding it Lars-Peter Clausen
2013-07-27 11:59 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 08/15] staging:iio:adis16260: Simplify calibscale and caliboffset reading Lars-Peter Clausen
2013-07-27 12:00 ` Jonathan Cameron [this message]
2013-07-17 14:44 ` [PATCH 09/15] staging:iio:adis16260: Fix minor style issue Lars-Peter Clausen
2013-07-27 12:01 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 10/15] staging:iio:adis16260: Remove 'SPS' suffix from samplerate attribute Lars-Peter Clausen
2013-07-27 12:01 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 11/15] staging:iio:adis16260: Add scale for the inclination channel Lars-Peter Clausen
2013-07-27 12:02 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 12/15] staging:iio:adis16260: Remove unused includes Lars-Peter Clausen
2013-07-27 12:03 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 13/15] staging:iio:adis16260: Add proper range checks to write_frequency() Lars-Peter Clausen
2013-07-27 12:04 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 14/15] staging:iio:adis16260: Remove sampling_frequency_available attribute Lars-Peter Clausen
2013-07-27 12:04 ` Jonathan Cameron
2013-07-17 14:44 ` [PATCH 15/15] staging:iio:adis16260: Move out of staging Lars-Peter Clausen
2013-07-27 12:08 ` Jonathan Cameron
2013-07-27 11:54 ` [PATCH 01/15] staging:iio:adis16260: Fix reading calibscale Jonathan Cameron
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=51F3B662.7070105@kernel.org \
--to=jic23@kernel.org \
--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.