On Tue, Jun 1, 2021 at 12:48 PM Radim Pavlik <radim.pavlik@xxxxxxxxxxxxxxxxxx> wrote: > Checking value of MCP_INTF in mcp23s08_irq suggests that the handler may be > called even when there is no interrupt pending. > > But the actual interrupt could happened between reading MCP_INTF and MCP_GPIO. > In this situation we got nothing from MCP_INTF, but the event gets acknowledged > on the expander by reading MCP_GPIO. This leads to losing events. > > Fix the problem by not reading any register until we see something in MCP_INTF. > > The error was reproduced and fix tested on MCP23017. > > Signed-off-by: Radim Pavlik <radim.pavlik@xxxxxxxxxxxxxxxxxx> The patch makes perfect sense to me. This message was mangled really seriously and could not be applied, but since the patch was simple I recreated it locally and applied for fixes. It also seems the lore mail archive has not accepted it. > + if (intf == 0) { > + /* There is no interrupt pending */ > + goto unlock; > + } > if (mcp_read(mcp, MCP_INTCAP, &intcap)) > goto unlock; > > @@ -368,10 +372,6 @@ static irqreturn_t mcp23s08_irq(int irq, void *data) > mcp->cached_gpio = gpio; > mutex_unlock(&mcp->lock); > > - if (intf == 0) { > - /* There is no interrupt pending */ > - return IRQ_HANDLED; > - } Paging some other mcp28s08 users to make sure they don't have a problem with this. Yours, Linus Walleij