net: phy: micrel: Change handler interrupt for lan8814
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Wed, 4 Jan 2023 19:42:18 +0000 (20:42 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 7 Jan 2023 03:33:33 +0000 (19:33 -0800)
commit7abd92a5b98f33a972bd3cadf9948ce59d1c01b8
tree2f050e05e1a5fe09f56a769daed3d6c718ce9e71
parentb466a25c930f2b7f1ed21c9eeaa553017ae78d1c
net: phy: micrel: Change handler interrupt for lan8814

The lan8814 represents a package of 4 PHYs. All of them are sharing the
same interrupt line. So when a link was going down/up or a frame was
timestamped, then the interrupt handler of all the PHYs was called.
Which is all fine and expected but the problem is the way the handler
interrupt works.
Basically if one of the PHYs timestamp a frame, then all the other 3
PHYs were polling the status of the interrupt until that PHY actually
cleared the interrupt by reading the timestamp.
The reason of polling was in case another PHY was also timestamping a
frame at the same time, it could miss this interrupt. But this is not
the right approach, because it is the interrupt controller who needs to
call the interrupt handlers again if the interrupt line is still
active.
Therefore change this such when the interrupt handler is called check
only if the interrupt is for itself, otherwise just exit. In this way
save CPU usage.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/20230104194218.3785229-1-horatiu.vultur@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/micrel.c