[U-Boot] [PATCH v4 1/4] bitops: introduce BIT() definition

Jagan Teki jteki at openedev.com
Tue Sep 8 20:03:00 CEST 2015


On 21 August 2015 at 22:31, Heiko Schocher <hs at denx.de> wrote:
> introduce BIT() definition, used in at91_udc gadget
> driver.
>
> Signed-off-by: Heiko Schocher <hs at denx.de>
>
> ---
>
> Changes in v4: None
> Changes in v3:
> - new in v3
>
> Changes in v2: None
>
>  include/linux/bitops.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/bitops.h b/include/linux/bitops.h
> index e724310..7d30ace 100644
> --- a/include/linux/bitops.h
> +++ b/include/linux/bitops.h
> @@ -3,6 +3,8 @@
>
>  #include <asm/types.h>
>
> +#define BIT(nr)                (1UL << (nr))
> +

Looks like few of them are interested with this BIT macro, but I'm
thinking this is not the right place just add above BIT_MASK

@@ -104,6 +104,7 @@  static inline unsigned int generic_hweight8(unsigned int w)
  return (res & 0x0F) + ((res >> 4) & 0x0F);
 }

+#define BIT(nr) (1UL << (nr))
 #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
 #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)

this will give an impression to have all BIT macro's at once like Linux.

>  /*
>   * ffs: find first bit set. This is defined the same way as
>   * the libc and compiler builtin ffs routines, therefore
> --
> 2.1.0

thanks!
-- 
Jagan | openedev.


More information about the U-Boot mailing list