Re: [PATCH 1/4] Blackfin: arch patch for 2.6.18

From: Arnd Bergmann
Date: Wed Sep 27 2006 - 16:57:14 EST


Am Wednesday 27 September 2006 19:19 schrieb Robin Getz:
> OK - I was just doing the similar thing to what already exists in
> ./asm-blackfin/system.h
>
> #define local_irq_enable() do {         \
>          __asm__ __volatile__ (          \
>                  "sti %0;"               \
>                  ::"d"(irq_flags));      \
> } while (0)
>
> which could be simplified to:
>
> #define local_irq_enable() __asm__ __volatile__ ("sti %0;" ::"d"(irq_flags));

Actually, this one is slightly broken, because of the ';' at the end of the
macro (think of "if(x) local_irq_enable(); else somthing_else()").

What I was suggesting is to make a proper inline function, like

static inline void local_irq_enable(void)
{
unsigned long unused_flags;
asm volatile ("sti %0;" : : "d" (unused_flags));
}

That completely avoids all the problems you might hit with macro expansion,
while still compiling to the same code.

Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/