Re: [PATCH] x86: Get rid of __HAVE_ARCH_CMPXCHG

From: Geert Uytterhoeven
Date: Fri Jul 11 2014 - 06:19:49 EST


On Fri, Jul 11, 2014 at 11:51 AM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> From: Borislav Petkov <bp@xxxxxxx>
>
> Both the 32-bit and 64-bit cmpxchg.h header define __HAVE_ARCH_CMPXCHG
> and there's ifdeffery which checks it. But since both bitness define it,
> we can just as well drop it and simpify a bit of code in doing that.
>
> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> ---
> arch/x86/include/asm/cmpxchg.h | 2 --
> arch/x86/include/asm/cmpxchg_32.h | 2 --
> arch/x86/include/asm/cmpxchg_64.h | 2 --
> arch/x86/include/asm/mc146818rtc.h | 2 +-
> arch/x86/include/asm/mutex_32.h | 16 ++--------------
> arch/x86/kernel/acpi/boot.c | 4 ----
> kernel/locking/rtmutex.c | 2 +-
> 7 files changed, 4 insertions(+), 26 deletions(-)

> --- a/kernel/locking/rtmutex.c
> +++ b/kernel/locking/rtmutex.c
> @@ -73,7 +73,7 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock)
> * We can speed up the acquire/release, if the architecture
> * supports cmpxchg and if there's no debugging state to be set up
> */
> -#if defined(__HAVE_ARCH_CMPXCHG) && !defined(CONFIG_DEBUG_RT_MUTEXES)
> +#ifndef CONFIG_DEBUG_RT_MUTEXES
> # define rt_mutex_cmpxchg(l,c,n) (cmpxchg(&l->owner, c, n) == c)
> static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
> {

What about non-x86? __HAVE_ARCH_CMPXCHG isn't always defined.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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/