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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 27, 2010 at 08:44:03AM -0500, Shinya Kuribayashi wrote:
> 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@xxxxxxxxx>
> ---
> 
>  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;
>  }
>  
>  /*

Thanks, I'll try this out.

-- 
David VL



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux