[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170322094114.GH32449@mwanda>
Date: Wed, 22 Mar 2017 12:41:14 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Arushi Singhal <arushisinghal19971997@...il.com>
Cc: outreachy-kernel@...glegroups.com, devel@...verdev.osuosl.org,
linux-fbdev@...r.kernel.org,
Teddy Wang <teddy.wang@...iconmotion.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: Re: staging: iio: Replace a bit shift by a use of BIT.
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@...il.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
Powered by blists - more mailing lists