[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170718100126.4mxihfhkipcujsqm@mwanda>
Date: Tue, 18 Jul 2017 13:01:26 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Jaya Durga <rjdurga@...il.com>
Cc: gregkh@...uxfoundation.org, devel@...verdev.osuosl.org,
lars@...afoo.de, Michael.Hennerich@...log.com,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
pmeerw@...erw.net, knaack.h@....de, jic23@...nel.org
Subject: Re: [PATCH 3/3] Staging: iio: adc: ad7280a.c: Fixed Macro argument
reuse
On Tue, Jul 18, 2017 at 03:17:52PM +0530, Jaya Durga wrote:
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index d5ab83f..cb94b7f 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -99,9 +99,12 @@
> #define AD7280A_DEVADDR_MASTER 0
> #define AD7280A_DEVADDR_ALL 0x1F
> /* 5-bit device address is sent LSB first */
> -#define AD7280A_DEVADDR(addr) (((addr & 0x1) << 4) | ((addr & 0x2) << 3) | \
> - (addr & 0x4) | ((addr & 0x8) >> 3) | \
> - ((addr & 0x10) >> 4))
> +static inline unsigned int AD7280A_DEVADDR(unsigned int addr)
Don't make this inline. GCC is going to ignore the inline anyway, and
make up its own mind about what to do. Change the name to not be all
caps. Generally, all caps means it's a macro.
> +{
> + return ((((addr & 0x1) << 4) | ((addr & 0x2) << 3) |
> + (addr & 0x4) | ((addr & 0x8) >> 3) |
> + ((addr & 0x10) >> 4)));
We don't need all the parens.
return ((addr & 0x1) << 4) |
((addr & 0x2) << 3) |
(addr & 0x4) |
((addr & 0x8) >> 3) |
((addr & 0x10) >> 4);
regards,
dan carpenter
Powered by blists - more mailing lists