From: Julia Lawall <julia.lawall@lip6.fr>
To: Aishwarya Pant <aishpant@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Barry Song <21cnbao@gmail.com>,
outreachy-kernel@googlegroups.com, linux-iio@vger.kernel.org
Subject: Re: [Outreachy kernel] [PATCH] staging: iio: accel: adis16201: remove local variable addr
Date: Thu, 23 Mar 2017 15:48:10 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1703231547290.3193@hadrien> (raw)
In-Reply-To: <20170323144453.GA7093@aishwarya>
On Thu, 23 Mar 2017, Aishwarya Pant wrote:
> Remove local variable addr from adis_read_reg_16() and adis_write_reg_16()
> as it is used only once.
>
> Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
> ---
> drivers/staging/iio/accel/adis16201.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c
> index fbc2406..b03c4f3 100644
> --- a/drivers/staging/iio/accel/adis16201.c
> +++ b/drivers/staging/iio/accel/adis16201.c
> @@ -175,7 +175,6 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
> struct adis *st = iio_priv(indio_dev);
> int ret;
> int bits;
> - u8 addr;
> s16 val16;
>
> switch (mask) {
> @@ -223,8 +222,9 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
> default:
> return -EINVAL;
> }
> - addr = adis16201_addresses[chan->scan_index];
> - ret = adis_read_reg_16(st, addr, &val16);
> + ret = adis_read_reg_16(st,
> + adis16201_addresses[chan->scan_index],
> + &val16);
The original code was probably nicer. One line shorter in the part that
actually does computation.
julia
> if (ret)
> return ret;
> val16 &= (1 << bits) - 1;
> @@ -244,7 +244,6 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
> struct adis *st = iio_priv(indio_dev);
> int bits;
> s16 val16;
> - u8 addr;
>
> switch (mask) {
> case IIO_CHAN_INFO_CALIBBIAS:
> @@ -259,8 +258,9 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
> return -EINVAL;
> }
> val16 = val & ((1 << bits) - 1);
> - addr = adis16201_addresses[chan->scan_index];
> - return adis_write_reg_16(st, addr, val16);
> + return adis_write_reg_16(st,
> + adis16201_addresses[chan->scan_index],
> + val16);
> }
> return -EINVAL;
> }
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170323144453.GA7093%40aishwarya.
> For more options, visit https://groups.google.com/d/optout.
>
next prev parent reply other threads:[~2017-03-23 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 14:44 [PATCH] staging: iio: accel: adis16201: remove local variable addr Aishwarya Pant
2017-03-23 14:48 ` Julia Lawall [this message]
2017-03-23 17:19 ` [Outreachy kernel] " 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=alpine.DEB.2.20.1703231547290.3193@hadrien \
--to=julia.lawall@lip6.fr \
--cc=21cnbao@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=aishpant@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--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