]> asedeno.scripts.mit.edu Git - linux.git/commit
net: phy: improve handling link_change_notify callback
authorHeiner Kallweit <hkallweit1@gmail.com>
Tue, 19 Mar 2019 18:56:51 +0000 (19:56 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Mar 2019 17:49:33 +0000 (10:49 -0700)
commit5c5f626bcacee0a345b8fd0af81be45eedb9bda9
treef945e423e4256563c1e232f1ab3a31b0bbf2e775
parent0b8515eddbd82f4aa3ad966aa4e6e708af461cc4
net: phy: improve handling link_change_notify callback

Currently the Phy driver's link_change_notify callback is called
whenever the state machine is run (every second if polling), no matter
whether the state changed or not. This isn't needed and may confuse
users considering the name of the callback. Actually it contradicts
its kernel-doc description. Therefore let's change the behavior and
call this callback only in case of an actual state change.

This requires changes to the at803x and rockchip drivers.
at803x can be simplified so that it reacts on a state change to
PHY_NOLINK only.
The rockchip driver can also be much simplified. We simply re-init
the AFE/DSP registers whenever we change to PHY_RUNNING and speed
is 100Mbps. This causes very small overhead because we do this even
if the speed was 100Mbps already. But this is negligible and
I think justified by the much simpler code.

Changes are compile-tested only.

A little bit problematic seems to be to find somebody with the
hardware to test the changes to the two PHY drivers. See also [0].
David may be able to test the Rockchip driver.

[0] https://marc.info/?t=153782508800006&r=1&w=2

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/at803x.c
drivers/net/phy/phy.c
drivers/net/phy/rockchip.c