FAILED: patch "[PATCH] phy: phy_ethtool_ksettings_set: Move after phy_start_aneg" failed to apply to 4.19-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 64cd92d5e8180c2ded3fdea76862de6f596ae2c9 Mon Sep 17 00:00:00 2001
From: Andrew Lunn <[email protected]>
Date: Sun, 24 Oct 2021 21:48:03 +0200
Subject: [PATCH] phy: phy_ethtool_ksettings_set: Move after phy_start_aneg
This allows it to make use of a helper which assume the PHY is already locked.
Fixes 2d55173e71b0 ("phy: add generic function to support ksetting support")
Signed-off-by Andrew Lunn <[email protected]>
Signed-off-by David S. Miller <[email protected]>
drivers/net/phy/phy.c +53 -53
@@ -243,59 +243,6 @@ static void phy_sanitize_settings(struct phy_device *phydev) } } -int phy_ethtool_ksettings_set (struct phy_device *phydev, -const struct ethtool_link_ksettings *cmd) -{ -__ETHTOOL_DECLARE_LINK_MODE_MASK (advertising); -u8 autoneg = cmd->base.autoneg; -u8 duplex = cmd->base.duplex; -u32 speed = cmd->base.speed; - -if (cmd->base.phy_address != phydev->mdio.addr) -return -EINVAL ; - -linkmode_copy (advertising, cmd->link_modes.advertising); - -/* We make sure that we don't pass unsupported values in to the PHY */ -linkmode_and (advertising, advertising, phydev->supported); - -/* Verify the settings we care about. */ -if (autoneg !=AUTONEG_ENABLE && autoneg !=AUTONEG_DISABLE ) -return -EINVAL ; - -if (autoneg ==AUTONEG_ENABLE &&linkmode_empty (advertising)) -return -EINVAL ; - -if (autoneg ==AUTONEG_DISABLE && - ((speed !=SPEED_1000 && - speed !=SPEED_100 && - speed !=SPEED_10 ) || - (duplex !=DUPLEX_HALF && - duplex !=DUPLEX_FULL ))) -return -EINVAL ; - - phydev->autoneg = autoneg; - -if (autoneg ==AUTONEG_DISABLE ) { - phydev->speed = speed; - phydev->duplex = duplex; - } - -linkmode_copy (phydev->advertising, advertising); - -linkmode_mod_bit (ETHTOOL_LINK_MODE_Autoneg_BIT, - phydev->advertising, autoneg ==AUTONEG_ENABLE ); - - phydev->master_slave_set = cmd->base.master_slave_cfg; - phydev->mdix_ctrl = cmd->base.eth_tp_mdix_ctrl; - -/* Restart the PHY */ -phy_start_aneg (phydev); - -return 0 ; -} -EXPORT_SYMBOL (phy_ethtool_ksettings_set); -void phy_ethtool_ksettings_get (struct phy_device *phydev,struct ethtool_link_ksettings *cmd) {
@@ -802,6 +749,59 @@ static int phy_poll_aneg_done(struct phy_device *phydev)return ret <0 ? ret :0 ; } +int phy_ethtool_ksettings_set (struct phy_device *phydev, +const struct ethtool_link_ksettings *cmd) +{ +__ETHTOOL_DECLARE_LINK_MODE_MASK (advertising); +u8 autoneg = cmd->base.autoneg; +u8 duplex = cmd->base.duplex; +u32 speed = cmd->base.speed; + +if (cmd->base.phy_address != phydev->mdio.addr) +return -EINVAL ; + +linkmode_copy (advertising, cmd->link_modes.advertising); + +/* We make sure that we don't pass unsupported values in to the PHY */ +linkmode_and (advertising, advertising, phydev->supported); + +/* Verify the settings we care about. */ +if (autoneg !=AUTONEG_ENABLE && autoneg !=AUTONEG_DISABLE ) +return -EINVAL ; + +if (autoneg ==AUTONEG_ENABLE &&linkmode_empty (advertising)) +return -EINVAL ; + +if (autoneg ==AUTONEG_DISABLE && + ((speed !=SPEED_1000 && + speed !=SPEED_100 && + speed !=SPEED_10 ) || + (duplex !=DUPLEX_HALF && + duplex !=DUPLEX_FULL ))) +return -EINVAL ; + + phydev->autoneg = autoneg; + +if (autoneg ==AUTONEG_DISABLE ) { + phydev->speed = speed; + phydev->duplex = duplex; + } + +linkmode_copy (phydev->advertising, advertising); + +linkmode_mod_bit (ETHTOOL_LINK_MODE_Autoneg_BIT, + phydev->advertising, autoneg ==AUTONEG_ENABLE ); + + phydev->master_slave_set = cmd->base.master_slave_cfg; + phydev->mdix_ctrl = cmd->base.eth_tp_mdix_ctrl; + +/* Restart the PHY */ +phy_start_aneg (phydev); + +return 0 ; +} +EXPORT_SYMBOL (phy_ethtool_ksettings_set); +/** * phy_speed_down - set speed to lowest speed supported by both link partners * @phydev: the phy_device struct