The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Akinobu Mita <mita@miraclelinux.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org,
	Akinobu Mita <mita@miraclelinux.com>,
	Russell King <rmk@arm.linux.org.uk>
Subject: [-mm patch 6/8] arm: fix undefined reference to generic_fls
Date: Tue, 21 Feb 2006 12:46:34 +0900	[thread overview]
Message-ID: <20060221034750.352424000@localhost.localdomain> (raw)
In-Reply-To: 20060221034628.799606000@localhost.localdomain

[-- Attachment #1: arm-fix.patch --]
[-- Type: text/plain, Size: 1337 bytes --]

This patch defines constant_fls() instead of removed generic_fls().

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: Russell King <rmk@arm.linux.org.uk>

 include/asm-arm/bitops.h |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletion(-)

Index: 2.6-mm/include/asm-arm/bitops.h
===================================================================
--- 2.6-mm.orig/include/asm-arm/bitops.h
+++ 2.6-mm/include/asm-arm/bitops.h
@@ -239,13 +239,42 @@ extern int _find_next_bit_be(const unsig
 
 #else
 
+static inline int constant_fls(int x)
+{
+	int r = 32;
+
+	if (!x)
+		return 0;
+	if (!(x & 0xffff0000u)) {
+		x <<= 16;
+		r -= 16;
+	}
+	if (!(x & 0xff000000u)) {
+		x <<= 8;
+		r -= 8;
+	}
+	if (!(x & 0xf0000000u)) {
+		x <<= 4;
+		r -= 4;
+	}
+	if (!(x & 0xc0000000u)) {
+		x <<= 2;
+		r -= 2;
+	}
+	if (!(x & 0x80000000u)) {
+		x <<= 1;
+		r -= 1;
+	}
+	return r;
+}
+
 /*
  * On ARMv5 and above those functions can be implemented around
  * the clz instruction for much better code efficiency.
  */
 
 #define fls(x) \
-	( __builtin_constant_p(x) ? generic_fls(x) : \
+	( __builtin_constant_p(x) ? constant_fls(x) : \
 	  ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) )
 #define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
 #define __ffs(x) (ffs(x) - 1)

--

  parent reply	other threads:[~2006-02-21  3:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-21  3:46 [-mm patch 0/8] fix build errors by bitops code consolidation Akinobu Mita
2006-02-21  3:46 ` [-mm patch 1/8] s/fucn/func/ typo fix Akinobu Mita
2006-02-21  3:46 ` [-mm patch 2/8] more s/fucn/func/ typo fixes Akinobu Mita
2006-02-21  3:46 ` [-mm patch 3/8] frv: remove unnesesary "&" Akinobu Mita
2006-02-21 10:51   ` David Howells
2006-02-21  3:46 ` [-mm patch 4/8] fix error: __u32 undeclared Akinobu Mita
2006-02-21  3:46 ` [-mm patch 5/8] um: fix undefined reference to hweight32 Akinobu Mita
2006-02-21 21:28   ` Jeff Dike
2006-02-21  3:46 ` Akinobu Mita [this message]
2006-02-21  3:46 ` [-mm patch 7/8] m68k: fix undefined reference to generic_find_next_zero_le_bit Akinobu Mita
2006-02-21  3:46 ` [-mm patch 8/8] ppc: fix undefined reference to hweight32 Akinobu Mita

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=20060221034750.352424000@localhost.localdomain \
    --to=mita@miraclelinux.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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