Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c43a2cc authored by Lendacky, Thomas's avatar Lendacky, Thomas Committed by David S. Miller
Browse files

amd-xgbe: Remove unnecessary spinlocks



Remove the spinlocks around the ethtool get and set settings
functions and within the link adjustment callback routine.

Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae29223e
Loading
Loading
Loading
Loading
+5 −15
Original line number Original line Diff line number Diff line
@@ -290,13 +290,9 @@ static int xgbe_get_settings(struct net_device *netdev,
	if (!pdata->phydev)
	if (!pdata->phydev)
		return -ENODEV;
		return -ENODEV;


	spin_lock_irq(&pdata->lock);

	ret = phy_ethtool_gset(pdata->phydev, cmd);
	ret = phy_ethtool_gset(pdata->phydev, cmd);
	cmd->transceiver = XCVR_EXTERNAL;
	cmd->transceiver = XCVR_EXTERNAL;


	spin_unlock_irq(&pdata->lock);

	DBGPR("<--xgbe_get_settings\n");
	DBGPR("<--xgbe_get_settings\n");


	return ret;
	return ret;
@@ -315,17 +311,14 @@ static int xgbe_set_settings(struct net_device *netdev,
	if (!pdata->phydev)
	if (!pdata->phydev)
		return -ENODEV;
		return -ENODEV;


	spin_lock_irq(&pdata->lock);

	speed = ethtool_cmd_speed(cmd);
	speed = ethtool_cmd_speed(cmd);


	ret = -EINVAL;
	if (cmd->phy_address != phydev->addr)
	if (cmd->phy_address != phydev->addr)
		goto unlock;
		return -EINVAL;


	if ((cmd->autoneg != AUTONEG_ENABLE) &&
	if ((cmd->autoneg != AUTONEG_ENABLE) &&
	    (cmd->autoneg != AUTONEG_DISABLE))
	    (cmd->autoneg != AUTONEG_DISABLE))
		goto unlock;
		return -EINVAL;


	if (cmd->autoneg == AUTONEG_DISABLE) {
	if (cmd->autoneg == AUTONEG_DISABLE) {
		switch (speed) {
		switch (speed) {
@@ -334,16 +327,16 @@ static int xgbe_set_settings(struct net_device *netdev,
		case SPEED_1000:
		case SPEED_1000:
			break;
			break;
		default:
		default:
			goto unlock;
			return -EINVAL;
		}
		}


		if (cmd->duplex != DUPLEX_FULL)
		if (cmd->duplex != DUPLEX_FULL)
			goto unlock;
			return -EINVAL;
	}
	}


	cmd->advertising &= phydev->supported;
	cmd->advertising &= phydev->supported;
	if ((cmd->autoneg == AUTONEG_ENABLE) && !cmd->advertising)
	if ((cmd->autoneg == AUTONEG_ENABLE) && !cmd->advertising)
		goto unlock;
		return -EINVAL;


	ret = 0;
	ret = 0;
	phydev->autoneg = cmd->autoneg;
	phydev->autoneg = cmd->autoneg;
@@ -359,9 +352,6 @@ static int xgbe_set_settings(struct net_device *netdev,
	if (netif_running(netdev))
	if (netif_running(netdev))
		ret = phy_start_aneg(phydev);
		ret = phy_start_aneg(phydev);


unlock:
	spin_unlock_irq(&pdata->lock);

	DBGPR("<--xgbe_set_settings\n");
	DBGPR("<--xgbe_set_settings\n");


	return ret;
	return ret;
+0 −5
Original line number Original line Diff line number Diff line
@@ -163,7 +163,6 @@ static void xgbe_adjust_link(struct net_device *netdev)
	struct xgbe_prv_data *pdata = netdev_priv(netdev);
	struct xgbe_prv_data *pdata = netdev_priv(netdev);
	struct xgbe_hw_if *hw_if = &pdata->hw_if;
	struct xgbe_hw_if *hw_if = &pdata->hw_if;
	struct phy_device *phydev = pdata->phydev;
	struct phy_device *phydev = pdata->phydev;
	unsigned long flags;
	int new_state = 0;
	int new_state = 0;


	if (phydev == NULL)
	if (phydev == NULL)
@@ -172,8 +171,6 @@ static void xgbe_adjust_link(struct net_device *netdev)
	DBGPR_MDIO("-->xgbe_adjust_link: address=%d, newlink=%d, curlink=%d\n",
	DBGPR_MDIO("-->xgbe_adjust_link: address=%d, newlink=%d, curlink=%d\n",
		   phydev->addr, phydev->link, pdata->phy_link);
		   phydev->addr, phydev->link, pdata->phy_link);


	spin_lock_irqsave(&pdata->lock, flags);

	if (phydev->link) {
	if (phydev->link) {
		/* Flow control support */
		/* Flow control support */
		if (pdata->pause_autoneg) {
		if (pdata->pause_autoneg) {
@@ -229,8 +226,6 @@ static void xgbe_adjust_link(struct net_device *netdev)
	if (new_state)
	if (new_state)
		phy_print_status(phydev);
		phy_print_status(phydev);


	spin_unlock_irqrestore(&pdata->lock, flags);

	DBGPR_MDIO("<--xgbe_adjust_link\n");
	DBGPR_MDIO("<--xgbe_adjust_link\n");
}
}