* [PATCH] (28/43) alpha xchg fix
@ 2005-08-23 21:47 Al Viro
2005-08-24 7:35 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2005-08-23 21:47 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
alpha xchg has to be a macro - alpha disables always_inline and if that
puppy does not get inlined, we immediately blow up on undefined reference.
Happens even on gcc3; with gcc4 that happens a _lot_.
Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
----
diff -urN RC13-rc6-git13-pcmcia-irq/include/asm-alpha/system.h RC13-rc6-git13-alpha-xchg/include/asm-alpha/system.h
--- RC13-rc6-git13-pcmcia-irq/include/asm-alpha/system.h 2005-06-17 15:48:29.000000000 -0400
+++ RC13-rc6-git13-alpha-xchg/include/asm-alpha/system.h 2005-08-21 13:17:10.000000000 -0400
@@ -443,22 +443,19 @@
if something tries to do an invalid xchg(). */
extern void __xchg_called_with_bad_pointer(void);
-static inline unsigned long
-__xchg(volatile void *ptr, unsigned long x, int size)
-{
- switch (size) {
- case 1:
- return __xchg_u8(ptr, x);
- case 2:
- return __xchg_u16(ptr, x);
- case 4:
- return __xchg_u32(ptr, x);
- case 8:
- return __xchg_u64(ptr, x);
- }
- __xchg_called_with_bad_pointer();
- return x;
-}
+#define __xchg(ptr, x, size) \
+({ \
+ unsigned long __xchg__res; \
+ volatile void *__xchg__ptr = (ptr); \
+ switch (size) { \
+ case 1: __xchg__res = __xchg_u8(__xchg__ptr, x); break; \
+ case 2: __xchg__res = __xchg_u16(__xchg__ptr, x); break; \
+ case 4: __xchg__res = __xchg_u32(__xchg__ptr, x); break; \
+ case 8: __xchg__res = __xchg_u64(__xchg__ptr, x); break; \
+ default: __xchg_called_with_bad_pointer(); __xchg__res = x; \
+ } \
+ __xchg__res; \
+})
#define xchg(ptr,x) \
({ \
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] (28/43) alpha xchg fix
2005-08-23 21:47 [PATCH] (28/43) alpha xchg fix Al Viro
@ 2005-08-24 7:35 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2005-08-24 7:35 UTC (permalink / raw)
To: Al Viro; +Cc: torvalds, linux-kernel
On Tue, Aug 23, 2005 at 10:47:07PM +0100, Al Viro wrote:
> alpha xchg has to be a macro - alpha disables always_inline and if that
> puppy does not get inlined, we immediately blow up on undefined reference.
> Happens even on gcc3; with gcc4 that happens a _lot_.
I think you should rather fix alpha to not disable always_inline. Having
one architecture behaving very different from the others is a rather bad
idea.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-08-24 7:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-23 21:47 [PATCH] (28/43) alpha xchg fix Al Viro
2005-08-24 7:35 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox