[U-Boot] [PATCH v4 3/4]: Define ffs/fls for all architectures

Simon Kagstrom simon.kagstrom at netinsight.net
Thu Sep 17 08:45:21 CEST 2009


On Wed, 16 Sep 2009 21:19:03 +0200
Stefan Roese <sr at denx.de> wrote:

> include/asm-ppc/bitops.h:
> @@ -230,6 +231,7 @@ extern __inline__ int ffs(int x)
>  {
>  	return __ilog2(x & -x) + 1;
>  }
> +#define ffs
> 
> So after "ffs()" is define as an inline function, you define it to nothing. I 
> understand that you need a flag for include/linux/bitops.h, to decide if the 
> platform version of this function should be used or the generic version:
> 
> include/linux/bitops.h:
> +#ifndef ffs
> +# define ffs generic_ffs
> +#endif
> 
> But this only works for platforms which don't supply a platform specific ffs 
> function.

Ah, of course... What did I think of? Time to wear a funny hat I guess...

> One way to solve this would be something like this:
>
> include/asm-ppc/bitops.h:
> @@ -230,6 +231,7 @@ extern __inline__ int ffs(int x)
>  {
>  	return __ilog2(x & -x) + 1;
>  }
> +#define PLATFORM_FFS
> 
> include/linux/bitops.h:
> +#ifndef PLATFORM_FFS
> +# define ffs generic_ffs
> +#endif

Yes, the patch should have contained something like that. Well, we'll
have to cook up a fix for this then. Sorry about that again.

// Simon


More information about the U-Boot mailing list