* Re: [PATCH] pinctrl: mcp23s08: fix race condition in irq handler
[not found] ` <AM7PR06MB6769E1183F68DEBB252F665ABA3E9@AM7PR06MB6769.eurprd06.prod.outlook.com>
@ 2021-06-06 22:28 ` Linus Walleij
0 siblings, 0 replies; only message in thread
From: Linus Walleij @ 2021-06-06 22:28 UTC (permalink / raw)
To: Radim Pavlik, Andy Shevchenko, Thomas Preston, Jan Kundrát,
Phil Reid, Lars Poeschel, Jason Kridner
Cc: linux-gpio, linux-kernel
On Tue, Jun 1, 2021 at 12:48 PM Radim Pavlik
<radim.pavlik@tbs-biometrics.com> 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@tbs-biometrics.com>
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-06 22:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20210601104429.GA26261@DESKTOP-I556OUN.localdomain>
[not found] ` <AM7PR06MB6769E1183F68DEBB252F665ABA3E9@AM7PR06MB6769.eurprd06.prod.outlook.com>
2021-06-06 22:28 ` [PATCH] pinctrl: mcp23s08: fix race condition in irq handler Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).