Re: [PATCH] IRQ: simplify OMAP2 mask_irq/unmask_irq code

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

 



On Tue, May 20, 2008 at 06:12:04PM -0600, Paul Walmsley wrote:
> On Wed, 21 May 2008, Kyungmin Park wrote:
> > On Wed, May 21, 2008 at 3:21 AM, Paul Walmsley <paul@xxxxxxxxx> wrote:
> > >
> > >  static void omap_mask_irq(unsigned int irq)
> > >  {
> > > -       int offset = (irq >> 5) << 5;
> > > +       int offset = irq & (~(IRQ_BITS_PER_REG - 1));
> > >
> > > -       if (irq >= 64)
> > > -               irq %= 64;
> > > -       else if (irq >= 32)
> > > -               irq %= 32;
> > > +       irq %= IRQ_BITS_PER_REG;
> > 
> > Is it the right conversion?
> > If the irq is greater then 32 and less then or equal to  64 it's
> > result is different.
> > E.g, If irq is 63 then original irq is 63, but new code is 31
> 
> Hmm, in that condition, the result looks the same to me: irq % 32, either 
> way?
> 
> More practically, if you look at what it does with that irq variable 
> afterwards, it seems to be a bug if irq is ever greater than 31:
> 
>         intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_CLEAR0 + 
>                             offset);
> 
> I think the only case where the new code would work differently than the 
> previous code is if irq > 95.  But that would be a bug, since the shift 
> value would then be > 32, for a 32-bit register.
> 
> > And if this code is right, how about to use mask instead of modulo op?
> > irq &= (IRQ_BITS_PER_REG - 1);
> 
> Hehe, very good point, that would probably save even more cycles!  If you 
> agree with the above, perhaps I can convert the code to use that also, 
> and add your Signed-off-by also?
> 
Kyungmin's idea looks good to me. If you roll the two together, feel free
to add my Acked-by also.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux