Message ID | 62b8375ae008035bcaa85c348ea4aa80c519bb07.1651037513.git.lukas@wunner.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Polling be gone on LAN95xx | expand |
On 27.04.22 07:48, Lukas Wunner wrote: > If reading the Interrupt Source Flag register fails with -ENODEV, then > the PHY has been hot-removed and the correct response is to bail out > instead of throwing a WARN splat and attempting to suspend the PHY. > The PHY should be stopped in due course anyway as the kernel > asynchronously tears down the device. > > Signed-off-by: Lukas Wunner <lukas@wunner.de> > --- > drivers/net/phy/smsc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c > index a521d48b22a7..35bff7fd234c 100644 > --- a/drivers/net/phy/smsc.c > +++ b/drivers/net/phy/smsc.c > @@ -91,7 +91,9 @@ static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev) > > irq_status = phy_read(phydev, MII_LAN83C185_ISF); > if (irq_status < 0) { > - phy_error(phydev); > + if (irq_status != -ENODEV) > + phy_error(phydev); > + > return IRQ_NONE; > } > Hi, picking a small nit, if you get ENODEV, you have no idea whether the irq was caused by the phy. Strictly speaking you should return IRQ_HANDLED in that case. Regards Oliver
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index a521d48b22a7..35bff7fd234c 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -91,7 +91,9 @@ static irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev) irq_status = phy_read(phydev, MII_LAN83C185_ISF); if (irq_status < 0) { - phy_error(phydev); + if (irq_status != -ENODEV) + phy_error(phydev); + return IRQ_NONE; }
If reading the Interrupt Source Flag register fails with -ENODEV, then the PHY has been hot-removed and the correct response is to bail out instead of throwing a WARN splat and attempting to suspend the PHY. The PHY should be stopped in due course anyway as the kernel asynchronously tears down the device. Signed-off-by: Lukas Wunner <lukas@wunner.de> --- drivers/net/phy/smsc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)