From: Shreeya Patel <shreeya.patel23498@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de,
pmeerw@pmeerw.net, gregkh@linuxfoundation.org,
linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, daniel.baluta@gmail.com
Subject: Re: [PATCH 6/6] Staging: iio: adis16209: Use sign_extend32 and adjust a switch statement
Date: Sat, 03 Mar 2018 21:07:53 +0530 [thread overview]
Message-ID: <1520091473.3137.4.camel@gmail.com> (raw)
In-Reply-To: <20180303160557.26462aa7@archlinux>
On Sat, 2018-03-03 at 16:05 +0000, Jonathan Cameron wrote:
> On Fri, 2 Mar 2018 19:04:49 +0530
> Shreeya Patel <shreeya.patel23498@gmail.com> wrote:
>
> >
> > Use sign_extend32 function instead of manually coding it.
> > Also, adjust a switch block to explicitly match channels
> > and return -EINVAL as default case which makes the code
> > semantically more clear.
> >
> > Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
> Changes are fine, but 2 changes to different things should be
> in 2 patches. Please split. I'd probably have taken this anyway if
> it hadn't been queued behind the requested changes to the previous 2
> patches anyway.
>
> Good work on this series though so looking forward to v3.
> Note please mark the set as [PATCH v3] to make it clear it
> is the 3rd version of some of this.
Yes, I'll do the changes.
Do I need to include the patches which have been merged from
this series in v3?
Thanks
>
> >
> > ---
> > drivers/staging/iio/accel/adis16209.c | 15 ++++++++++-----
> > 1 file changed, 10 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/staging/iio/accel/adis16209.c
> > b/drivers/staging/iio/accel/adis16209.c
> > index 7363fd0..5ab44a4 100644
> > --- a/drivers/staging/iio/accel/adis16209.c
> > +++ b/drivers/staging/iio/accel/adis16209.c
> > @@ -150,10 +150,16 @@ static int adis16209_read_raw(struct iio_dev
> > *indio_dev,
> > switch (chan->type) {
> > case IIO_VOLTAGE:
> > *val = 0;
> > - if (chan->channel == 0)
> > + switch (chan->channel) {
> > + case 0:
> > *val2 = 305180; /* 0.30518 mV */
> > - else
> > + break;
> > + case 1:
> > *val2 = 610500; /* 0.6105 mV */
> > + break;
> > + default:
> > + return -EINVAL;
> > + }
> > return IIO_VAL_INT_PLUS_MICRO;
> > case IIO_TEMP:
> > *val = -470;
> > @@ -197,9 +203,8 @@ static int adis16209_read_raw(struct iio_dev
> > *indio_dev,
> > ret = adis_read_reg_16(st, addr, &val16);
> > if (ret)
> > return ret;
> > - val16 &= (1 << bits) - 1;
> > - val16 = (s16)(val16 << (16 - bits)) >> (16 -
> > bits);
> > - *val = val16;
> > +
> > + *val = sign_extend32(val16, bits - 1);
> > return IIO_VAL_INT;
> > }
> > return -EINVAL;
next prev parent reply other threads:[~2018-03-03 15:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-02 13:16 [PATCH 0/6] adis16209 driver cleanup Shreeya Patel
2018-03-02 13:19 ` [PATCH 1/6] Staging: iio: adis16209: Arrange headers in alphabetical order Shreeya Patel
2018-03-03 15:39 ` Jonathan Cameron
2018-03-02 13:23 ` [PATCH 2/6] Staging: iio: adis16209: Change the definition name Shreeya Patel
2018-03-03 15:40 ` Jonathan Cameron
2018-03-02 13:25 ` [PATCH 3/6] Staging: iio: adis16209: Add _REG postfix for registers Shreeya Patel
2018-03-03 15:42 ` Jonathan Cameron
2018-03-02 13:28 ` [PATCH 4/6] Staging: iio: adis16209: Remove unnecessary comments and group the definitions Shreeya Patel
2018-03-03 15:57 ` Jonathan Cameron
2018-03-02 13:32 ` [PATCH 5/6] Staging: iio: adis16209: Add some informatic comments Shreeya Patel
2018-03-03 16:01 ` Jonathan Cameron
2018-03-03 15:33 ` Shreeya Patel
2018-03-02 13:34 ` [PATCH 6/6] Staging: iio: adis16209: Use sign_extend32 and adjust a switch statement Shreeya Patel
2018-03-03 16:05 ` Jonathan Cameron
2018-03-03 15:37 ` Shreeya Patel [this message]
2018-03-03 16:16 ` 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=1520091473.3137.4.camel@gmail.com \
--to=shreeya.patel23498@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=daniel.baluta@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox