linux/include
Heiner Kallweit 2b3e88ea65 net: phy: improve phy state checking
Add helpers phy_is_started() and __phy_is_started() to avoid open-coded
checks whether PHY has been started. To make the check easier move
PHY_HALTED before PHY_UP in enum phy_state. Further improvements:

phy_start_aneg():
Return -EBUSY and print warning if function is called from a non-started
state (DOWN, READY, HALTED). Better check because function is exported
and drivers may use it incorrectly.

phy_interrupt():
Return IRQ_NONE also if state is DOWN or READY. We should never receive
an interrupt in one of these states, but better play safe.

phy_stop():
Just return and print a warning if PHY is in a non-started state.
This warning should help to identify drivers with unbalanced calls to
phy_start() / phy_stop().

phy_state_machine():
Schedule state machine run only if PHY is in a started state.
E.g. if state is READY we don't need the state machine, it will be
started by phy_start().

v2:
- don't use __func__ within phy_warn_state
v3:
- use WARN() instead of printing error message to facilitate debugging

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-12-18 15:11:07 -08:00
..
acpi
asm-generic
clocksource
crypto
drm
dt-bindings
keys
kvm
linux net: phy: improve phy state checking 2018-12-18 15:11:07 -08:00
math-emu
media
memory
misc
net Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next 2018-12-18 08:49:48 -08:00
pcmcia
ras
rdma
scsi
soc soc/qman: add return value to interrupt coalesce changing APIs 2018-11-23 11:17:06 -08:00
sound ALSA: pcm: Fix interval evaluation with openmin/max 2018-11-29 12:05:19 +01:00
target
trace Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-12-09 21:43:31 -08:00
uapi neighbor: Add protocol attribute 2018-12-16 12:15:25 -08:00
video
xen Revert "xen/balloon: Mark unallocated host memory as UNUSABLE" 2018-11-29 17:53:31 +01:00