Patchwork [U-Boot,5/5] x86: Add ilog2 to bitops

login
register
mail settings
Submitter Graeme Russ
Date April 29, 2012, noon
Message ID <1335700823-15144-6-git-send-email-graeme.russ@gmail.com>
Download mbox | patch
Permalink /patch/155731/
State Superseded, archived
Delegated to: Simon Glass
Headers show

Comments

Graeme Russ - April 29, 2012, noon
ilog2 is required by AHCI driver

Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
---
 arch/x86/include/asm/bitops.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Simon Glass - Nov. 28, 2012, 1:32 a.m.
On Sun, Apr 29, 2012 at 5:00 AM, Graeme Russ <graeme.russ@gmail.com> wrote:
> ilog2 is required by AHCI driver
>
> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>

Applied to x86/next.

Patch

diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index c7a38f2..5a7e4cb 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -351,6 +351,11 @@  static __inline__ int ffs(int x)
 }
 #define PLATFORM_FFS
 
+static inline int __ilog2(unsigned int x)
+{
+	return generic_fls(x) - 1;
+}
+
 /**
  * hweightN - returns the hamming weight of a N-bit word
  * @x: the word to weigh