summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-11-22 15:23:23 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-31 16:36:15 +0100
commitf4f8b2ec1ebf68d490dd896e5590b898908dd218 (patch)
treed5c4942eed0cd7bce09a7b39bbe63f71b1be0ce3
parent9234c9254e22da026e351cd4b7028e216abbeef0 (diff)
downloadlinux-stable-f4f8b2ec1ebf68d490dd896e5590b898908dd218.tar.gz
linux-stable-f4f8b2ec1ebf68d490dd896e5590b898908dd218.tar.bz2
linux-stable-f4f8b2ec1ebf68d490dd896e5590b898908dd218.zip
net: phy: initialise phydev speed and duplex sanely
[ Upstream commit a5d66f810061e2dd70fb7a108dcd14e535bc639f ] When a phydev is created, the speed and duplex are set to zero and -1 respectively, rather than using the predefined SPEED_UNKNOWN and DUPLEX_UNKNOWN constants. There is a window at initialisation time where we may report link down using the 0/-1 values. Tidy this up and use the predefined constants, so debug doesn't complain with: "Unsupported (update phy-core.c)/Unsupported (update phy-core.c)" when the speed and duplex settings are printed. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/phy/phy_device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 6144146aec29..43c4f358eeb8 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -420,8 +420,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
mdiodev->device_free = phy_mdio_device_free;
mdiodev->device_remove = phy_mdio_device_remove;
- dev->speed = 0;
- dev->duplex = -1;
+ dev->speed = SPEED_UNKNOWN;
+ dev->duplex = DUPLEX_UNKNOWN;
dev->pause = 0;
dev->asym_pause = 0;
dev->link = 0;