From: Rusty Russell <rusty@rustcorp.com.au>
To: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Cc: Mike Travis <travis@sgi.com>, Chris Zankel <chris@zankel.net>,
David Howells <dhowells@redhat.com>,
Koichi Yasutake <yasutake.koichi@jp.panasonic.com>,
linux-am33-list@redhat.com,
Hirokazu Takata <takata@linux-m32r.org>,
linux-m32r@ml.linux-m32r.org,
Yoshinori Sato <ysato@users.sourceforge.jp>
Subject: Re: git-pull request for tip/cpus4096
Date: Sat, 3 Jan 2009 16:31:46 +1030 [thread overview]
Message-ID: <200901031631.47818.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20090102180942.GB10072@elte.hu>
On Saturday 03 January 2009 04:39:42 Ingo Molnar wrote:
> these architectures have no __fls() implementation ...
...
> arch/cris : 0
> arch/frv : 0
> arch/h8300 : 0
> arch/m32r : 0
> arch/m68k : 0
> arch/mn10300 : 0
> arch/um : 0
> arch/xtensa : 0
These are the non-linux-next archs.
I've already patched m68k (but it's in include/asm-m68k) and um doesn't
need it.
Fixes are below, and pushed into my cpumask git tree.
Thanks,
Rusty.
commit 5ece5c5192d065c229da01e7b347c1d3877b59fa
Author: Rusty Russell <rusty@rustcorp.com.au>
Date: Sat Jan 3 16:21:08 2009 +1030
xtensa: define __fls
Like fls, but can't be handed 0 and returns the bit number.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h
index 23261e8..6c39303 100644
--- a/include/asm-xtensa/bitops.h
+++ b/include/asm-xtensa/bitops.h
@@ -82,6 +82,16 @@ static inline int fls (unsigned int x)
return 32 - __cntlz(x);
}
+/**
+ * __fls - find last (most-significant) set bit in a long word
+ * @word: the word to search
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+static inline unsigned long __fls(unsigned long word)
+{
+ return 31 - __cntlz(word);
+}
#else
/* Use the generic implementation if we don't have the nsa/nsau instructions. */
@@ -90,6 +100,7 @@ static inline int fls (unsigned int x)
# include <asm-generic/bitops/__ffs.h>
# include <asm-generic/bitops/ffz.h>
# include <asm-generic/bitops/fls.h>
+# include <asm-generic/bitops/__fls.h>
#endif
commit 5c134dad43443aa9c9606eaf47c378a6b9c5c597
Author: Rusty Russell <rusty@rustcorp.com.au>
Date: Sat Jan 3 16:19:03 2009 +1030
mn10300: define __fls
Like fls, but can't be handed 0 and returns the bit number.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/include/asm-mn10300/bitops.h b/include/asm-mn10300/bitops.h
index cc6d40c..0b610f4 100644
--- a/include/asm-mn10300/bitops.h
+++ b/include/asm-mn10300/bitops.h
@@ -196,6 +196,17 @@ int fls(int x)
}
/**
+ * __fls - find last (most-significant) set bit in a long word
+ * @word: the word to search
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+static inline unsigned long __fls(unsigned long word)
+{
+ return __ilog2_u32(word);
+}
+
+/**
* ffs - find first bit set
* @x: the word to search
*
commit 16a206260ee70f181de6a3672678545859589ef2
Author: Rusty Russell <rusty@rustcorp.com.au>
Date: Sat Jan 3 16:16:54 2009 +1030
m32r: define __fls
Like fls, but can't be handed 0 and returns the bit number.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h
index 6dc9b81..aaddf0d 100644
--- a/include/asm-m32r/bitops.h
+++ b/include/asm-m32r/bitops.h
@@ -251,6 +251,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
#include <asm-generic/bitops/ffz.h>
#include <asm-generic/bitops/__ffs.h>
#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/fls64.h>
#ifdef __KERNEL__
commit 9ddabc2a29163e4b243d10c5e06fc5584073d7ad
Author: Rusty Russell <rusty@rustcorp.com.au>
Date: Sat Jan 3 16:16:04 2009 +1030
h8300: define __fls
Like fls, but can't be handed 0 and returns the bit number.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/arch/h8300/include/asm/bitops.h b/arch/h8300/include/asm/bitops.h
index cb18e3b..cb9ddf5 100644
--- a/arch/h8300/include/asm/bitops.h
+++ b/arch/h8300/include/asm/bitops.h
@@ -207,6 +207,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
#endif /* __KERNEL__ */
#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/fls64.h>
#endif /* _H8300_BITOPS_H */
commit ee38e5140bafbf40e1bd25ab917ac8db54a27799
Author: Rusty Russell <rusty@rustcorp.com.au>
Date: Sat Jan 3 16:14:05 2009 +1030
frv: define __fls
Like fls, but can't be handed 0 and returns the bit number.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index 39456ba..287f6f6 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -339,6 +339,19 @@ int __ffs(unsigned long x)
return 31 - bit;
}
+/**
+ * __fls - find last (most-significant) set bit in a long word
+ * @word: the word to search
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+static inline unsigned long __fls(unsigned long word)
+{
+ unsigned long bit;
+ asm("scan %1,gr0,%0" : "=r"(bit) : "r"(word));
+ return bit;
+}
+
/*
* special slimline version of fls() for calculating ilog2_u32()
* - note: no protection against n == 0
next prev parent reply other threads:[~2009-01-03 6:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-02 17:00 git-pull request for tip/cpus4096 Mike Travis
2009-01-02 18:09 ` Ingo Molnar
2009-01-02 18:24 ` Mike Travis
2009-01-03 6:01 ` Rusty Russell [this message]
2009-01-03 6:18 ` Stephen Rothwell
2009-01-03 10:03 ` Rusty Russell
2009-01-03 10:20 ` Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200901031631.47818.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=chris@zankel.net \
--cc=dhowells@redhat.com \
--cc=linux-am33-list@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m32r@ml.linux-m32r.org \
--cc=mingo@elte.hu \
--cc=takata@linux-m32r.org \
--cc=travis@sgi.com \
--cc=yasutake.koichi@jp.panasonic.com \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox