From: Dan Carpenter <dan.carpenter@oracle.com>
To: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: outreachy-kernel@googlegroups.com, devel@driverdev.osuosl.org,
linux-fbdev@vger.kernel.org,
Teddy Wang <teddy.wang@siliconmotion.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: Re: staging: iio: Replace a bit shift by a use of BIT.
Date: Wed, 22 Mar 2017 09:41:14 +0000 [thread overview]
Message-ID: <20170322094114.GH32449@mwanda> (raw)
In-Reply-To: <20170322024942.GA21242@arushi-HP-Pavilion-Notebook>
On Wed, Mar 22, 2017 at 08:19:42AM +0530, Arushi Singhal wrote:
> This patch replaces bit shifting on 1 with the BIT(x) macro.
> This was done with coccinelle:
> @@
> constant c;
> @@
>
> -1 << c
> +BIT(c)
>
> Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
> ---
> drivers/staging/iio/adc/ad7816.c | 2 +-
> drivers/staging/iio/cdc/ad7150.c | 2 +-
> drivers/staging/iio/cdc/ad7746.c | 22 +++++++++++-----------
> 3 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
> index 17d280581e24..42f637ca0251 100644
> --- a/drivers/staging/iio/adc/ad7816.c
> +++ b/drivers/staging/iio/adc/ad7816.c
> @@ -222,7 +222,7 @@ static ssize_t ad7816_show_value(struct device *dev,
> value = (s8)((data >> AD7816_TEMP_FLOAT_OFFSET) - 103);
> data &= AD7816_TEMP_FLOAT_MASK;
> if (value < 0)
> - data = (1 << AD7816_TEMP_FLOAT_OFFSET) - data;
> + data = (BIT(AD7816_TEMP_FLOAT_OFFSET)) - data;
Remove the extra parentheses from all of these:
data = BIT(AD7816_TEMP_FLOAT_OFFSET) - data;
regards,
dan carpenter
prev parent reply other threads:[~2017-03-22 9:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 2:49 staging: iio: Replace a bit shift by a use of BIT Arushi Singhal
2017-03-22 6:01 ` Greg Kroah-Hartman
2017-03-22 8:53 ` Arnd Bergmann
2017-03-22 9:41 ` Dan Carpenter [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=20170322094114.GH32449@mwanda \
--to=dan.carpenter@oracle.com \
--cc=arushisinghal19971997@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=sudipm.mukherjee@gmail.com \
--cc=teddy.wang@siliconmotion.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).