提交 249bc974 编写于 作者: H Heiner Kallweit 提交者: David S. Miller

net: phy: avoid clearing PHY interrupts twice in irq handler

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: 49644e68 ("net: phy: add callback for custom interrupt handler to struct phy_driver")
Reported-by: NMichael Walle <michael@walle.cc>
Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 52c0d4e3
...@@ -727,7 +727,8 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) ...@@ -727,7 +727,8 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
phy_trigger_machine(phydev); 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; goto phy_err;
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -557,6 +557,7 @@ struct phy_driver { ...@@ -557,6 +557,7 @@ struct phy_driver {
/* /*
* Checks if the PHY generated an interrupt. * Checks if the PHY generated an interrupt.
* For multi-PHY devices with shared PHY interrupt pin * For multi-PHY devices with shared PHY interrupt pin
* Set interrupt bits have to be cleared.
*/ */
int (*did_interrupt)(struct phy_device *phydev); int (*did_interrupt)(struct phy_device *phydev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册