[Top] [All Lists]

[PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is

Subject: [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required
From: Shinya Kuribayashi <>
Date: Sun, 27 Jun 2010 22:44:03 +0900
Dkim-signature: v=1; a=rsa-sha1; c=relaxed;; h=message-id :date:from:mime-version:to:cc:subject:content-type :content-transfer-encoding; s=sasl; bh=3YTkrFCINFccsmzTNRNtfVPYC VM=; b=P9+H+g3bDt8uOLiurSqXUAHjt4Mjdbr2D40fLmopr8PItd0jaFpETkDdf ByW1UhjmL+ctxPU5ov9wet+Yu0Kg+DihOoO0OGVctR3Ba5Pd2A5sOHne0ywTaJfW 6J0cRGlMOAARrFH+JLzMCv5wraa0QlTA+h7+A7fFdVEiZhxk/0=
Domainkey-signature: a=rsa-sha1; c=nofws;; h=message-id:date :from:mime-version:to:cc:subject:content-type :content-transfer-encoding; q=dns; s=sasl; b=DVafIXfwzWYsl0ybzJS UBTmW9Rve751hrbCY0LjHmqS+j050Y2B2WA4j32U9MhtZAqJDzvnWQfHs4ryE7Fo rYffZtvQz5m/K31VVWsQBsNO84v/jj0UHg9XygMhP5VuEEH9ioq87QjDLZZ2x5Fd jdGXum4Y4WYfNDlFiHlYg3zA=
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100423 Thunderbird/3.0.4
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

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 <>

 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 
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;

<Prev in Thread] Current Thread [Next in Thread>