lkml.org 
[lkml]   [2008]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86: simplify sync_test_bit()
Jan Beulich wrote:
> There really is no need for a redundant implementation here, just keep
> the alternative name for allowing consumers to use consistent naming.
>
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
>
> --- a/include/asm-x86/sync_bitops.h
> +++ b/include/asm-x86/sync_bitops.h
> @@ -130,26 +130,7 @@ static inline int sync_test_and_change_b
> return oldbit;
> }
>
> -static __always_inline int sync_constant_test_bit(int nr, const volatile unsigned long *addr)
> -{
> - return ((1UL << (nr & 31)) &
> - (((const volatile unsigned int *)addr)[nr >> 5])) != 0;
> -}
> -
> -static inline int sync_var_test_bit(int nr, const volatile unsigned long * addr)
> -{
> - int oldbit;
> -
> - __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
> - :"=r" (oldbit)
> - :"m" (ADDR),"Ir" (nr));
> - return oldbit;
> -}
> -
> -#define sync_test_bit(nr,addr) \
> - (__builtin_constant_p(nr) ? \
> - sync_constant_test_bit((nr),(addr)) : \
> - sync_var_test_bit((nr),(addr)))
> +#define sync_test_bit test_bit
Hm,

#define sync_test_bit(nr, addr) test_bit(nr, addr)

would be better, but seems reasonable to me. Or even an inline for
consistency.

J


\
 
 \ /
  Last update: 2008-03-14 16:09    [W:0.085 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site