summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2011-07-05 04:38:51 +0000
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2011-07-16 13:00:11 +0200
commit0b9bc73711aed13246dd2cb91a3f658eeb25baf5 (patch)
treeb26c3da20acebabca94d35f91a587815ccbffc06
parenta60d1e5b8e5007f53c198acc5ca636ae570ae180 (diff)
downloadu-boot-imx-0b9bc73711aed13246dd2cb91a3f658eeb25baf5.zip
u-boot-imx-0b9bc73711aed13246dd2cb91a3f658eeb25baf5.tar.gz
u-boot-imx-0b9bc73711aed13246dd2cb91a3f658eeb25baf5.tar.bz2
arm: add __ilog2 function
Add __ilog2 function for ARM. Needed for ahci.c Signed-off-by: Rob Herring <rob.herring@calxeda.com> Cc: Albert ARIBAUD <albert.aribaud@free.fr>
-rw-r--r--arch/arm/include/asm/bitops.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index 270f163..879e20e 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..