Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1247843
| From | Marek Vasut <marex@denx.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] asm-generic: cmpxchg: avoid warnings from macro-ized cmpxchg() implementations |
| Date | 2015-10-15 16:30 +0200 |
| Message-ID | <qjRHz-AM-11@gated-at.bofh.it> (permalink) |
| References | <qaig2-7KZ-13@gated-at.bofh.it> <qjvQK-2a2-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wednesday, October 14, 2015 at 05:01:45 PM, Arnd Bergmann wrote: > On Saturday 19 September 2015 06:42:21 Marek Vasut wrote: > > This change is similar to e001bbae7147b111fe1aa42beaf835635f3c016e > > ARM: cmpxchg: avoid warnings from macro-ized cmpxchg() implementations > > > > A recent change in kernel/acct.c added a new warning for many > > configurations using generic __xchg() implementation: > > > > In file included from ./arch/nios2/include/asm/cmpxchg.h:12:0, > > > > from include/asm-generic/atomic.h:18, > > from arch/nios2/include/generated/asm/atomic.h:1, > > from include/linux/atomic.h:4, > > from include/linux/spinlock.h:406, > > from include/linux/mmzone.h:7, > > from include/linux/gfp.h:5, > > from include/linux/mm.h:9, > > > > from kernel/acct.c:46: > > kernel/acct.c: In function 'acct_pin_kill': > > include/asm-generic/cmpxchg.h:94:3: warning: value computed is not used > > [-Wunused-value] > > > > ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned > > long)(o),\ > > > > ^ > > > > include/asm-generic/cmpxchg.h:102:28: note: in expansion of macro > > 'cmpxchg_local' > > > > #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) > > > > ^ > > > > kernel/acct.c:177:2: note: in expansion of macro 'cmpxchg' > > > > cmpxchg(&acct->ns->bacct, pin, NULL); > > ^ > > > > The code is in fact correct, it's just a cmpxchg() call that > > intentionally ignores the result, and no other code does that. The > > warning does not show up on x86 because of the way that its cmpxchg() > > macro is written. This changes the asm-ggeneric implementation to use > > a similar construct with a compound expression instead of a typecast, > > which causes the compiler to not complain about an unused result. > > > > Fix the other macros in this file in a similar way, and place them > > just below their function implementations. > > > > Signed-off-by: Marek Vasut <marex@denx.de> > > Cc: Russell King <rmk+kernel@arm.linux.org.uk> > > Applied to my asm-generic tree, thanks! Thank you! Now I really hope someone doesn't flame me to a crisp for breaking some odd architecture ;-) Best regards, Marek Vasut -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH] asm-generic: cmpxchg: avoid warnings from macro-ized cmpxchg() implementations Arnd Bergmann <arnd@arndb.de> - 2015-10-14 17:10 +0200 Re: [PATCH] asm-generic: cmpxchg: avoid warnings from macro-ized cmpxchg() implementations Marek Vasut <marex@denx.de> - 2015-10-15 16:30 +0200
csiph-web