mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] m32r: fix build warning
@ 2017-01-14 22:24 Sudip Mukherjee
  0 siblings, 0 replies; 2+ messages in thread
From: Sudip Mukherjee @ 2017-01-14 22:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Sudip Mukherjee

Some m32r builds were having a warning:

arch/m32r/include/asm/cmpxchg.h:191:3:
	warning: value computed is not used


arch/m32r/include/asm/cmpxchg.h:68:3:
	warning: value computed is not used

Taking the idea from e001bbae7147 ("ARM: cmpxchg: avoid warnings from
macro-ized cmpxchg() implementations") the m32r implementation is
changed to use a similar construct with a compound expression instead
of a typecast, which causes the compiler to not complain about an
unused result.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
 arch/m32r/include/asm/cmpxchg.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/m32r/include/asm/cmpxchg.h b/arch/m32r/include/asm/cmpxchg.h
index 14bf9b7..23c9d05 100644
--- a/arch/m32r/include/asm/cmpxchg.h
+++ b/arch/m32r/include/asm/cmpxchg.h
@@ -64,8 +64,10 @@
 	return (tmp);
 }
 
-#define xchg(ptr, x)							\
-	((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
+#define xchg(ptr, x) ({							\
+	((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr),		\
+				    sizeof(*(ptr))));			\
+})
 
 static __always_inline unsigned long
 __xchg_local(unsigned long x, volatile void *ptr, int size)
@@ -187,9 +189,12 @@
 	return old;
 }
 
-#define cmpxchg(ptr, o, n)						 \
-	((__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)(o),	 \
-			(unsigned long)(n), sizeof(*(ptr))))
+#define cmpxchg(ptr, o, n) ({				\
+	((__typeof__(*(ptr)))				\
+		 __cmpxchg((ptr), (unsigned long)(o),	\
+			   (unsigned long)(n),		\
+			   sizeof(*(ptr))));		\
+})
 
 #include <asm-generic/cmpxchg-local.h>
 
-- 
1.9.1

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] m32r: fix build warning
@ 2016-11-15 21:13 Sudip Mukherjee
  0 siblings, 0 replies; 2+ messages in thread
From: Sudip Mukherjee @ 2016-11-15 21:13 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Sudip Mukherjee

While building m32r defconfig we got warnings:

arch/m32r/platforms/m32700ut/setup.c:249:24: warning:
  'm32700ut_lcdpld_irq_type' defined but not used [-Wunused-variable]

m32700ut_lcdpld_irq_type is only used when CONFIG_USB is enabled.
Modify the code to declare the related variables and functions only
when CONFIG_USB is enabled.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---

build log is at:
https://travis-ci.org/sudipm-mukherjee/parport/jobs/175943814

 arch/m32r/platforms/m32700ut/setup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/m32r/platforms/m32700ut/setup.c b/arch/m32r/platforms/m32700ut/setup.c
index 9a4ba8a..349eb34 100644
--- a/arch/m32r/platforms/m32700ut/setup.c
+++ b/arch/m32r/platforms/m32700ut/setup.c
@@ -201,6 +201,7 @@ static void shutdown_m32700ut_lanpld(struct irq_data *data)
 #define lcdpldirq2port(x)	(unsigned long)((int)M32700UT_LCD_ICUCR1 + \
 				 (((x) - 1) * sizeof(unsigned short)))
 
+#ifdef CONFIG_USB
 static pld_icu_data_t lcdpld_icu_data[M32700UT_NUM_LCD_PLD_IRQ];
 
 static void disable_m32700ut_lcdpld_irq(unsigned int irq)
@@ -253,6 +254,7 @@ static void shutdown_m32700ut_lcdpld(struct irq_data *data)
 	.irq_mask	= mask_m32700ut_lcdpld,
 	.irq_unmask	= unmask_m32700ut_lcdpld,
 };
+#endif
 
 void __init init_IRQ(void)
 {
-- 
1.9.1

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

end of thread, other threads:[~2017-01-14 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-14 22:24 [PATCH] m32r: fix build warning Sudip Mukherjee
  -- strict thread matches above, loose matches on Subject: below --
2016-11-15 21:13 Sudip Mukherjee

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

all inboxes | Powered by JetHome®