Re: [PATCH 2/3] i2c: sh_mobile: Use platform_get_irq_optional() to get the interrupt

From: Arnd Bergmann
Date: Wed Feb 09 2022 - 17:57:26 EST


On Wed, Feb 9, 2022 at 5:08 PM Sergei Shtylyov
<sergei.shtylyov@xxxxxxxxx> wrote:
> On 2/9/22 7:02 PM, Arnd Bergmann wrote:
> >
> > + shlr2 r4
> > + shlr r4
> > + mov r4, r0 ! save vector->jmp table offset for later
> > +
> > + shlr2 r4 ! vector to IRQ# conversion
> > + add #-0x10, r4
> > +
> > + cmp/pz r4 ! is it a valid IRQ?
> > + bt 10f
> >
> > gets the vector (0x200 for this device), shifts it five bits to 0x10,
> > and subtracts 0x10,
> > then branches to do_IRQ if the interrupt number is non-zero, otherwise it goes
> > through the exception_handling_table.
>
> The SH4 manual I found on my disk (have it from MontaVista times) tells me cmp/pz
> sets T if Rn is >= 0, then bt branches if T = 1. So I do think the code is correct.
> One more thing: the board code for those boards was added in 2011, we can assume
> it was working back then, right? :-_

Indeed, this does make more sense, I had not realized that the numbers could get
negative here.

Arnd