linux-mips
[Top] [All Lists]

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

To: dvomlehn@cisco.com
Subject: [PATCH] MIPS: PowerTV: Use fls() carefully where static optimization is required
From: Shinya Kuribayashi <skuribay@pobox.com>
Date: Sun, 27 Jun 2010 22:44:03 +0900
Cc: linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; 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; d=pobox.com; 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=
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) 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
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


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