Re: [PATCH 2/2] Use <asm-generic/bitops/le.h> in <asm-powerpc/bitops.h>

From: Vegard Nossum
Date: Sat May 31 2008 - 18:53:14 EST


Hi,

On Sun, Jun 1, 2008 at 12:38 AM, Ben Hutchings
<bhutchings@xxxxxxxxxxxxxx> wrote:
> The powerpc little-endian bitops have no arch-specific optimisations.
>
> Remove clashing macros from these headers.
>
> Signed-off-by: Ben Hutchings <bhutchings@xxxxxxxxxxxxxx>
> ---
> include/asm-generic/bitops/le.h | 1 -
> include/asm-powerpc/bitops.h | 34 +---------------------------------
> 2 files changed, 1 insertions(+), 34 deletions(-)
>
> diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
> index a51c4ca..08c5df3 100644
> --- a/include/asm-generic/bitops/le.h
> +++ b/include/asm-generic/bitops/le.h
> @@ -4,7 +4,6 @@
> #include <asm/types.h>
> #include <asm/byteorder.h>
>
> -#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
> #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
>
> #if defined(__LITTLE_ENDIAN)
> diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
> index dcbf9a8..afe2fa3 100644
> --- a/include/asm-powerpc/bitops.h
> +++ b/include/asm-powerpc/bitops.h
> @@ -54,7 +54,6 @@
>
> #define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
> #define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
> -#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
>
> static __inline__ void set_bit(int nr, volatile unsigned long *addr)
> {
> @@ -340,39 +339,8 @@ static __inline__ int fls64(__u64 x)
>
> /* Little-endian versions */
>
> -static __inline__ int test_le_bit(unsigned long nr,
> - __const__ unsigned long *addr)
> -{
> - __const__ unsigned char *tmp = (__const__ unsigned char *) addr;
> - return (tmp[nr >> 3] >> (nr & 7)) & 1;
> -}
> +#include <asm-generic/bitops/le.h>

Is it completely impossible to move this #include to the top of the file?

I know that a lot of the current headers don't do this, and I don't
think it's a written rule with the kernel sources, BUT it's a nice
convention IMHO, and makes headers generally more maintainable. What
do you think?


Vegard

--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
--
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/