[U-Boot] [PATCH v5] bitops: introduce BIT() definition

Scott Wood scottwood at freescale.com
Wed Sep 9 21:04:38 CEST 2015


On Wed, 2015-09-09 at 20:25 +0200, Wolfgang Denk wrote:
> Dear Andreas,
> 
> In message <1441626234-16364-1-git-send-email-andreas.devel at googlemail.com> 
> you wrote:
> ...
> > --- a/include/linux/bitops.h
> > +++ b/include/linux/bitops.h
> > @@ -3,6 +3,8 @@
> >  
> >  #include <asm/types.h>
> >  
> > +#define BIT(nr)            (1UL << (nr))
> 
> What happens when someone decides to use this on a 64 bit register?
> 
> Also, this definition is inherently wrong for Power Architecture (TM)
> systems, where bit 0 is the most significant bit.

It's not "inherently wrong" to number bits from LSB on such systems -- it 
just doesn't match the unusual convention found in PPC documentation and the 
rotate instructions.

In any case, this would be part of the Linux driver compatibility layer 
rather than the placement in common.h that you previously objected to.

-Scott



More information about the U-Boot mailing list