Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: micrel: Fix lan8841_config_intr after getting out of sleep mode

When the interrupt is enabled, the function lan8841_config_intr tries to
clear any pending interrupts by reading the interrupt status, then
checks the return value for errors and then continue to enable the
interrupt. It has been seen that once the system gets out of sleep mode,
the interrupt status has the value 0x400 meaning that the PHY detected
that the link was in low power. That is correct value but the problem is
that the check is wrong. We try to check for errors but we return an
error also in this case which is not an error. Therefore fix this by
returning only when there is an error.

Fixes: a8f1a19d27ef ("net: micrel: Add support for lan8841 PHY")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Suman Ghosh <sumang@marvell.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20240524085350.359812-1-horatiu.vultur@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Horatiu Vultur and committed by
Jakub Kicinski
4fb67904 bf0497f5

+9 -1
+9 -1
drivers/net/phy/micrel.c
··· 4029 4029 4030 4030 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 4031 4031 err = phy_read(phydev, LAN8814_INTS); 4032 - if (err) 4032 + if (err < 0) 4033 4033 return err; 4034 4034 4035 4035 /* Enable / disable interrupts. It is OK to enable PTP interrupt ··· 4045 4045 return err; 4046 4046 4047 4047 err = phy_read(phydev, LAN8814_INTS); 4048 + if (err < 0) 4049 + return err; 4050 + 4051 + /* Getting a positive value doesn't mean that is an error, it 4052 + * just indicates what was the status. Therefore make sure to 4053 + * clear the value and say that there is no error. 4054 + */ 4055 + err = 0; 4048 4056 } 4049 4057 4050 4058 return err;