All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required
@ 2010-06-27 13:44 Shinya Kuribayashi
  2010-06-30 17:48 ` David VomLehn
  2010-06-30 22:01 ` David VomLehn
  0 siblings, 2 replies; 13+ messages in thread
From: Shinya Kuribayashi @ 2010-06-27 13:44 UTC (permalink / raw)
  To: dvomlehn; +Cc: linux-mips

fls()/__fls() defined at <asm/bitops.h>, doesn't use CLZ unless it's
explicitly requested via <cpu-features-overrides.h>.  In other words,
as long as depending on cpu_data[0].isa_level, CLZ is nerver used for
fls()/__fls().

Looking at leftover clz() in asic_int.c, PowerTV used to use Malta's
clz() and irq_ffs() as-is, then for some reason made a decision not to
use clz().

It's MIPS32 machine and luckily clz() is left there, then let's go back
to the original shape.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
---

 Compile checked, and now CLZ is back.

 arch/mips/powertv/asic/asic_int.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/powertv/asic/asic_int.c b/arch/mips/powertv/asic/asic_int.c
index 529c44a..e3c08a2 100644
--- a/arch/mips/powertv/asic/asic_int.c
+++ b/arch/mips/powertv/asic/asic_int.c
@@ -86,7 +86,7 @@ static inline int clz(unsigned long x)
  */
 static inline unsigned int irq_ffs(unsigned int pending)
 {
-	return fls(pending) - 1 + CAUSEB_IP;
+	return -clz(pending) + 31 - CAUSEB_IP;
 }
 
 /*
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-07-11 14:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-27 13:44 [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required Shinya Kuribayashi
2010-06-30 17:48 ` David VomLehn
2010-06-30 22:01 ` David VomLehn
2010-07-02 14:13   ` Shinya Kuribayashi
2010-07-02 21:32     ` David VomLehn
2010-07-03 14:31       ` Shinya Kuribayashi
2010-07-03 17:03         ` Maciej W. Rozycki
2010-07-05  0:33           ` Shinya Kuribayashi
2010-07-05 11:43             ` Ralf Baechle
2010-07-05 13:35             ` Maciej W. Rozycki
2010-07-06 11:17               ` Shinya Kuribayashi
2010-07-06  1:22         ` Ralf Baechle
2010-07-11 14:01     ` Shinya Kuribayashi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.