From: Heiner Kallweit Date: Sun, 1 Mar 2020 20:36:09 +0000 (+0100) Subject: net: phy: avoid clearing PHY interrupts twice in irq handler X-Git-Tag: v5.4.26~73 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d365c7b4747379bc489c126727431994c908796;p=platform%2Fkernel%2Flinux-rpi.git net: phy: avoid clearing PHY interrupts twice in irq handler [ Upstream commit 249bc9744e165abe74ae326f43e9d70bad54c3b7 ] On all PHY drivers that implement did_interrupt() reading the interrupt status bits clears them. This means we may loose an interrupt that is triggered between calling did_interrupt() and phy_clear_interrupt(). As part of the fix make it a requirement that did_interrupt() clears the interrupt. The Fixes tag refers to the first commit where the patch applies cleanly. Fixes: 49644e68f472 ("net: phy: add callback for custom interrupt handler to struct phy_driver") Reported-by: Michael Walle Signed-off-by: Heiner Kallweit Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 105d389b..ea890d8 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -761,7 +761,8 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) phy_trigger_machine(phydev); } - if (phy_clear_interrupt(phydev)) + /* did_interrupt() may have cleared the interrupt already */ + if (!phydev->drv->did_interrupt && phy_clear_interrupt(phydev)) goto phy_err; return IRQ_HANDLED; diff --git a/include/linux/phy.h b/include/linux/phy.h index 3d5d533..bf87c59 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -524,6 +524,7 @@ struct phy_driver { /* * Checks if the PHY generated an interrupt. * For multi-PHY devices with shared PHY interrupt pin + * Set interrupt bits have to be cleared. */ int (*did_interrupt)(struct phy_device *phydev);