From: Rob Herring Date: Tue, 5 Jul 2011 04:38:51 +0000 (+0000) Subject: arm: add __ilog2 function X-Git-Tag: v2011.09-rc1~219^2~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0b9bc73711aed13246dd2cb91a3f658eeb25baf5;p=u-boot arm: add __ilog2 function Add __ilog2 function for ARM. Needed for ahci.c Signed-off-by: Rob Herring Cc: Albert ARIBAUD --- diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index 270f163eee..879e20e024 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -106,6 +106,11 @@ static inline int test_bit(int nr, const void * addr) return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); } +static inline int __ilog2(unsigned int x) +{ + return generic_fls(x) - 1; +} + /* * ffz = Find First Zero in word. Undefined if no zero exists, * so code should check against ~0UL first..