diff mbox

Dove: Fix irq_to_pmu()

Message ID 20121118163932.GW3290@n2100.arm.linux.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Russell King - ARM Linux Nov. 18, 2012, 4:39 p.m. UTC
PMU interrupts start at IRQ_DOVE_PMU_START, not IRQ_DOVE_PMU_START + 1.
Fix the condition.  (It may have been less likely to occur had the code
been written "if (irq >= IRQ_DOVE_PMU_START" which imho is the easier
to understand notation, and matches the normal way of thinking about
these things.)

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Comments

Sergei Shtylyov Nov. 18, 2012, 7 p.m. UTC | #1
Hello.

On 18-11-2012 20:39, Russell King - ARM Linux wrote:

> PMU interrupts start at IRQ_DOVE_PMU_START, not IRQ_DOVE_PMU_START + 1.
> Fix the condition.  (It may have been less likely to occur had the code
> been written "if (irq >= IRQ_DOVE_PMU_START" which imho is the easier
> to understand notation, and matches the normal way of thinking about
> these things.)

> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> --

    Should be "---", or somebody (you?) will have to hand edit the patch when 
applying...

WBR, Sergei
Russell King - ARM Linux Nov. 18, 2012, 8:38 p.m. UTC | #2
On Sun, Nov 18, 2012 at 11:00:28PM +0400, Sergei Shtylyov wrote:
> Hello.
>
> On 18-11-2012 20:39, Russell King - ARM Linux wrote:
>
>> PMU interrupts start at IRQ_DOVE_PMU_START, not IRQ_DOVE_PMU_START + 1.
>> Fix the condition.  (It may have been less likely to occur had the code
>> been written "if (irq >= IRQ_DOVE_PMU_START" which imho is the easier
>> to understand notation, and matches the normal way of thinking about
>> these things.)
>
>> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
>> --
>
>    Should be "---", or somebody (you?) will have to hand edit the patch 
> when applying...

Sorry, can never remember that...
Jason Cooper Nov. 18, 2012, 9:02 p.m. UTC | #3
On Sun, Nov 18, 2012 at 08:38:15PM +0000, Russell King - ARM Linux wrote:
> On Sun, Nov 18, 2012 at 11:00:28PM +0400, Sergei Shtylyov wrote:
> > Hello.
> >
> > On 18-11-2012 20:39, Russell King - ARM Linux wrote:
> >
> >> PMU interrupts start at IRQ_DOVE_PMU_START, not IRQ_DOVE_PMU_START + 1.
> >> Fix the condition.  (It may have been less likely to occur had the code
> >> been written "if (irq >= IRQ_DOVE_PMU_START" which imho is the easier
> >> to understand notation, and matches the normal way of thinking about
> >> these things.)
> >
> >> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> >> --
> >
> >    Should be "---", or somebody (you?) will have to hand edit the patch 
> > when applying...
> 
> Sorry, can never remember that...

No problem, I'll handle it when I pull it in.

thx,

Jason.
diff mbox

Patch

diff --git a/arch/arm/mach-dove/include/mach/pm.h b/arch/arm/mach-dove/include/mach/pm.h
index 1c942c0..02a0073 100644
--- a/arch/arm/mach-dove/include/mach/pm.h
+++ b/arch/arm/mach-dove/include/mach/pm.h
@@ -184,7 +184,7 @@  static inline int pmu_to_irq(int pin)
 
 static inline int irq_to_pmu(int irq)
 {
-	if (IRQ_DOVE_PMU_START < irq && irq < NR_IRQS)
+	if (IRQ_DOVE_PMU_START <= irq && irq < NR_IRQS)
 		return irq - IRQ_DOVE_PMU_START;
 
 	return -EINVAL;