Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-07 Thread Daniel Mack
On Fri, Jun 05, 2009 at 10:44:21PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: > > This adds generic bit operations for all platforms and enables includes > > the implementations from asm-arm. > > > > Code taken from Linux kernel. > > > the __set_bit, __clear_bit, __change_bit & co generic is

Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-05 Thread Jean-Christophe PLAGNIOL-VILLARD
On 12:27 Thu 04 Jun , Daniel Mack wrote: > This adds generic bit operations for all platforms and enables includes > the implementations from asm-arm. > > Code taken from Linux kernel. > the __set_bit, __clear_bit, __change_bit & co generic is used on arm ok but be aware that we use it in U-

Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-04 Thread Wolfgang Denk
Dear Daniel Mack, In message <20090604180042.gn26...@buzzloop.caiaq.de> you wrote: > > Ok. I just saw ubifs implementing its own set_bit() functions and > considered that the wrong place for such functions to live in. ext2 > seems to do the same things, also minix. Platforms which want to > enable

Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-04 Thread Stefan Roese
On Thursday 04 June 2009 20:00:42 Daniel Mack wrote: > On Thu, Jun 04, 2009 at 01:59:22PM +0200, Wolfgang Denk wrote: > > > And the functions I removed from asm-arm/bitops.h did that? > > > > No. Let's be happy that we have eliminated some poor code, and if we > > add a replacement, let's make sure

Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-04 Thread Daniel Mack
On Thu, Jun 04, 2009 at 01:59:22PM +0200, Wolfgang Denk wrote: > > And the functions I removed from asm-arm/bitops.h did that? > > No. Let's be happy that we have eliminated some poor code, and if we > add a replacement, let's make sure not to repeat the mistakes of the > past again. Ok. I just s

Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-04 Thread Wolfgang Denk
Dear Daniel Mack, In message <20090604114818.gh26...@buzzloop.caiaq.de> you wrote: > > > > +#define BIT(nr) (1UL << (nr)) > > > +#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) > > > +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) > > > +#define BITS_PER_

Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-04 Thread Daniel Mack
On Thu, Jun 04, 2009 at 01:47:17PM +0200, Wolfgang Denk wrote: > > +static inline void clear_bit(int nr, volatile unsigned long *addr) > > +{ > > + unsigned long mask = BIT_MASK(nr); > > + unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); > > + > > + *p &= ~mask; > > +} > > Such cod

Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-04 Thread Daniel Mack
On Thu, Jun 04, 2009 at 01:45:22PM +0200, Wolfgang Denk wrote: > > +#define BIT(nr)(1UL << (nr)) > > +#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) > > +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) > > +#define BITS_PER_BYTE 8 > > +

Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-04 Thread Wolfgang Denk
Dear Daniel Mack, In message <1244111241-32735-3-git-send-email-dan...@caiaq.de> you wrote: > This adds generic bit operations for all platforms and enables includes > the implementations from asm-arm. I should have read the patch to end... > +static inline void set_bit(int nr, volatile unsigned

Re: [U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-04 Thread Wolfgang Denk
Dear Daniel Mack, In message <1244111241-32735-3-git-send-email-dan...@caiaq.de> you wrote: > This adds generic bit operations for all platforms and enables includes > the implementations from asm-arm. Be careful. I am not sure if a generic definition is even possible. In any case, it is extremel

[U-Boot] [PATCH 2/3] Add generic bit operations

2009-06-04 Thread Daniel Mack
This adds generic bit operations for all platforms and enables includes the implementations from asm-arm. Code taken from Linux kernel. Signed-off-by: Daniel Mack --- include/asm-arm/bitops.h |2 + include/asm-generic/bitops.h | 151 ++ 2 files c