Linux IIO development
 help / color / mirror / Atom feed
* [PATCH 3/3] Staging: iio: adc: ad7280a.c: Fixed Macro argument reuse
@ 2017-07-18  9:47 Jaya Durga
  2017-07-18 10:01 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Jaya Durga @ 2017-07-18  9:47 UTC (permalink / raw)
  To: gregkh
  Cc: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, linux-iio,
	devel, linux-kernel, Jaya Durga

CHECK: Macro argument reuse 'addr' - possible side-effects?

convert AD7280A_DEVADDR to inline function to fix checkpath check

Signed-off-by: Jaya Durga <rjdurga@gmail.com>
---
 drivers/staging/iio/adc/ad7280a.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

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)
+{
+	return ((((addr & 0x1) << 4) | ((addr & 0x2) << 3) |
+		  (addr & 0x4) | ((addr & 0x8) >> 3) |
+		  ((addr & 0x10) >> 4)));
+}
 
 /* During a read a valid write is mandatory.
  * So writing to the highest available address (Address 0x1F)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-18 10:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18  9:47 [PATCH 3/3] Staging: iio: adc: ad7280a.c: Fixed Macro argument reuse Jaya Durga
2017-07-18 10:01 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox