public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] ARM: S5PV310: Optimize interrupt source searching code
@ 2010-09-28  1:31 Kukjin Kim
  2010-09-28 12:45 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Kukjin Kim @ 2010-09-28  1:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Changhwan Youn <chaos.youn@samsung.com>

It is reported by Junseok Jung that using clz instruction is
better instead of using for-loop to find the interrupt source.
This patch modifies interrupt source searching code using __fls().
The __fls() is implemented using clz instruction.

Suggested-by: Junseok Jung <jundols.jung@samsung.com>
Signed-off-by: Changhwan Youn <chaos.youn@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s5pv310/irq-combiner.c b/arch/arm/mach-s5pv310/irq-combiner.c
index 0f70521..39e3647 100644
--- a/arch/arm/mach-s5pv310/irq-combiner.c
+++ b/arch/arm/mach-s5pv310/irq-combiner.c
@@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
 	if (status == 0)
 		goto out;
 
-	for (combiner_irq = 0; combiner_irq < 32; combiner_irq++) {
-		if (status & 0x1)
-			break;
-		status >>= 1;
-	}
+	combiner_irq = __fls(status);
 
 	cascade_irq = combiner_irq + (chip_data->irq_offset & ~31);
 	if (unlikely(cascade_irq >= NR_IRQS))
-- 
1.6.2.5

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

* [PATCH] ARM: S5PV310: Optimize interrupt source searching code
  2010-09-28  1:31 [PATCH] ARM: S5PV310: Optimize interrupt source searching code Kukjin Kim
@ 2010-09-28 12:45 ` Sergei Shtylyov
  2010-09-28 13:01   ` Michał Nazarewicz
  2010-09-28 13:10   ` Kukjin Kim
  0 siblings, 2 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2010-09-28 12:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 28-09-2010 5:31, Kukjin Kim wrote:

> From: Changhwan Youn<chaos.youn@samsung.com>

> It is reported by Junseok Jung that using clz instruction is
> better instead of using for-loop to find the interrupt source.
> This patch modifies interrupt source searching code using __fls().
> The __fls() is implemented using clz instruction.

> Suggested-by: Junseok Jung<jundols.jung@samsung.com>
> Signed-off-by: Changhwan Youn<chaos.youn@samsung.com>
> Signed-off-by: Kukjin Kim<kgene.kim@samsung.com>
> ---
>   arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
>   1 files changed, 1 insertions(+), 5 deletions(-)

> diff --git a/arch/arm/mach-s5pv310/irq-combiner.c b/arch/arm/mach-s5pv310/irq-combiner.c
> index 0f70521..39e3647 100644
> --- a/arch/arm/mach-s5pv310/irq-combiner.c
> +++ b/arch/arm/mach-s5pv310/irq-combiner.c
> @@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
>   	if (status == 0)
>   		goto out;
>
> -	for (combiner_irq = 0; combiner_irq<  32; combiner_irq++) {
> -		if (status & 0x1)
> -			break;
> -		status>>= 1;
> -	}
> +	combiner_irq = __fls(status);

    But the loop finds the *first* set bit, not the last...

WBR, Sergei

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

* [PATCH] ARM: S5PV310: Optimize interrupt source searching code
  2010-09-28 12:45 ` Sergei Shtylyov
@ 2010-09-28 13:01   ` Michał Nazarewicz
  2010-09-28 14:07     ` Kukjin Kim
  2010-09-28 13:10   ` Kukjin Kim
  1 sibling, 1 reply; 5+ messages in thread
From: Michał Nazarewicz @ 2010-09-28 13:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 28 Sep 2010 14:45:59 +0200, Sergei Shtylyov <sshtylyov@mvista.com> wrote:

> Hello.
>
> On 28-09-2010 5:31, Kukjin Kim wrote:
>
>> From: Changhwan Youn<chaos.youn@samsung.com>
>
>> It is reported by Junseok Jung that using clz instruction is
>> better instead of using for-loop to find the interrupt source.
>> This patch modifies interrupt source searching code using __fls().
>> The __fls() is implemented using clz instruction.
>
>> Suggested-by: Junseok Jung<jundols.jung@samsung.com>
>> Signed-off-by: Changhwan Youn<chaos.youn@samsung.com>
>> Signed-off-by: Kukjin Kim<kgene.kim@samsung.com>
>> ---
>>   arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
>>   1 files changed, 1 insertions(+), 5 deletions(-)
>
>> diff --git a/arch/arm/mach-s5pv310/irq-combiner.c b/arch/arm/mach-s5pv310/irq-combiner.c
>> index 0f70521..39e3647 100644
>> --- a/arch/arm/mach-s5pv310/irq-combiner.c
>> +++ b/arch/arm/mach-s5pv310/irq-combiner.c
>> @@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
>>   	if (status == 0)
>>   		goto out;
>>
>> -	for (combiner_irq = 0; combiner_irq<  32; combiner_irq++) {
>> -		if (status & 0x1)
>> -			break;
>> -		status>>= 1;
>> -	}
>> +	combiner_irq = __fls(status);
>
>     But the loop finds the *first* set bit, not the last...

__ffs than?

-- 
Best regards,                                        _     _
| Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
| Computer Science,  Micha? "mina86" Nazarewicz       (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--

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

* [PATCH] ARM: S5PV310: Optimize interrupt source searching code
  2010-09-28 12:45 ` Sergei Shtylyov
  2010-09-28 13:01   ` Michał Nazarewicz
@ 2010-09-28 13:10   ` Kukjin Kim
  1 sibling, 0 replies; 5+ messages in thread
From: Kukjin Kim @ 2010-09-28 13:10 UTC (permalink / raw)
  To: linux-arm-kernel

Sergei Shtylyov wrote:
> 
> Hello.
> 
Hi ;-)

> On 28-09-2010 5:31, Kukjin Kim wrote:
> 
> > From: Changhwan Youn<chaos.youn@samsung.com>
> 
> > It is reported by Junseok Jung that using clz instruction is
> > better instead of using for-loop to find the interrupt source.
> > This patch modifies interrupt source searching code using __fls().
> > The __fls() is implemented using clz instruction.
> 
> > Suggested-by: Junseok Jung<jundols.jung@samsung.com>
> > Signed-off-by: Changhwan Youn<chaos.youn@samsung.com>
> > Signed-off-by: Kukjin Kim<kgene.kim@samsung.com>
> > ---
> >   arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
> >   1 files changed, 1 insertions(+), 5 deletions(-)
> 
> > diff --git a/arch/arm/mach-s5pv310/irq-combiner.c
b/arch/arm/mach-s5pv310/irq-
> combiner.c
> > index 0f70521..39e3647 100644
> > --- a/arch/arm/mach-s5pv310/irq-combiner.c
> > +++ b/arch/arm/mach-s5pv310/irq-combiner.c
> > @@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int
irq,
> struct irq_desc *desc)
> >   	if (status == 0)
> >   		goto out;
> >
> > -	for (combiner_irq = 0; combiner_irq<  32; combiner_irq++) {
> > -		if (status & 0x1)
> > -			break;
> > -		status>>= 1;
> > -	}
> > +	combiner_irq = __fls(status);
> 
>     But the loop finds the *first* set bit, not the last...
> 
Yes, you're right.
So I already re-submitted like following :-)

http://lists.infradead.org/pipermail/linux-arm-kernel/2010-September/027071.
html

Thanks for your pointing out.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

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

* [PATCH] ARM: S5PV310: Optimize interrupt source searching code
  2010-09-28 13:01   ` Michał Nazarewicz
@ 2010-09-28 14:07     ` Kukjin Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Kukjin Kim @ 2010-09-28 14:07 UTC (permalink / raw)
  To: linux-arm-kernel

Michal Nazarewicz wrote:
> 
Hi :-)

> On Tue, 28 Sep 2010 14:45:59 +0200, Sergei Shtylyov <sshtylyov@mvista.com>
> wrote:
> 
> > Hello.
> >
> > On 28-09-2010 5:31, Kukjin Kim wrote:
> >
> >> From: Changhwan Youn<chaos.youn@samsung.com>
> >
> >> It is reported by Junseok Jung that using clz instruction is
> >> better instead of using for-loop to find the interrupt source.
> >> This patch modifies interrupt source searching code using __fls().
> >> The __fls() is implemented using clz instruction.
> >
> >> Suggested-by: Junseok Jung<jundols.jung@samsung.com>
> >> Signed-off-by: Changhwan Youn<chaos.youn@samsung.com>
> >> Signed-off-by: Kukjin Kim<kgene.kim@samsung.com>
> >> ---
> >>   arch/arm/mach-s5pv310/irq-combiner.c |    6 +-----
> >>   1 files changed, 1 insertions(+), 5 deletions(-)
> >
> >> diff --git a/arch/arm/mach-s5pv310/irq-combiner.c b/arch/arm/mach-s5pv310/irq-
> combiner.c
> >> index 0f70521..39e3647 100644
> >> --- a/arch/arm/mach-s5pv310/irq-combiner.c
> >> +++ b/arch/arm/mach-s5pv310/irq-combiner.c
> >> @@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int
> irq, struct irq_desc *desc)
> >>   	if (status == 0)
> >>   		goto out;
> >>
> >> -	for (combiner_irq = 0; combiner_irq<  32; combiner_irq++) {
> >> -		if (status & 0x1)
> >> -			break;
> >> -		status>>= 1;
> >> -	}
> >> +	combiner_irq = __fls(status);
> >
> >     But the loop finds the *first* set bit, not the last...
> 
> __ffs than?
> 
Yes, already re-submitted.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28  1:31 [PATCH] ARM: S5PV310: Optimize interrupt source searching code Kukjin Kim
2010-09-28 12:45 ` Sergei Shtylyov
2010-09-28 13:01   ` Michał Nazarewicz
2010-09-28 14:07     ` Kukjin Kim
2010-09-28 13:10   ` Kukjin Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox