net: phy: fixed_phy: handle link-down case
authorStas Sergeev <stsp@list.ru>
Tue, 21 Jul 2015 00:49:56 +0000 (17:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2015 23:12:55 +0000 (16:12 -0700)
commit868a4215be9a6d80548ccb74763b883dc99d32a2
tree5cb16961e37d0ae39c485ab0b8ff871595701459
parentd2eac98f7d1b950b762a7eca05a9ce0ea1d878d2
net: phy: fixed_phy: handle link-down case

fixed_phy_register() currently hardcodes the fixed PHY link to 1, and
expects to find a "speed" parameter to provide correct information
towards the fixed PHY consumer.

In a subsequent change, where we allow "managed" (e.g: (RS)GMII in-band
status auto-negotiation) fixed PHYs, none of these parameters can be
provided since they will be auto-negotiated, hence, we just provide a
zero-initialized fixed_phy_status to fixed_phy_register() which makes it
fail when we call fixed_phy_update_regs() since status.speed = 0 which
makes us hit the "default" label and error out.

Without this change, we would also see potentially inconsistent
speed/duplex parameters for fixed PHYs when the link is DOWN.

CC: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net>
[florian: add more background to why this is correct and desirable]
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/fixed_phy.c