aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLendacky, Thomas <Thomas.Lendacky@amd.com>2014-08-01 12:56:29 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-02 22:29:53 -0400
commit8c43a2cc75b3bf4f89ea439f4439a2a61f22c961 (patch)
treeae733f9d96c697a62698c3f1442c2ea42cfb19fd
parentae29223eaf0ecf4c701457a6b40d7b8f19c90413 (diff)
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: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c20
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-mdio.c5
2 files changed, 5 insertions, 20 deletions
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index 6005b6021f78..a076aca138a1 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -290,13 +290,9 @@ static int xgbe_get_settings(struct net_device *netdev,
290 if (!pdata->phydev) 290 if (!pdata->phydev)
291 return -ENODEV; 291 return -ENODEV;
292 292
293 spin_lock_irq(&pdata->lock);
294
295 ret = phy_ethtool_gset(pdata->phydev, cmd); 293 ret = phy_ethtool_gset(pdata->phydev, cmd);
296 cmd->transceiver = XCVR_EXTERNAL; 294 cmd->transceiver = XCVR_EXTERNAL;
297 295
298 spin_unlock_irq(&pdata->lock);
299
300 DBGPR("<--xgbe_get_settings\n"); 296 DBGPR("<--xgbe_get_settings\n");
301 297
302 return ret; 298 return ret;
@@ -315,17 +311,14 @@ static int xgbe_set_settings(struct net_device *netdev,
315 if (!pdata->phydev) 311 if (!pdata->phydev)
316 return -ENODEV; 312 return -ENODEV;
317 313
318 spin_lock_irq(&pdata->lock);
319
320 speed = ethtool_cmd_speed(cmd); 314 speed = ethtool_cmd_speed(cmd);
321 315
322 ret = -EINVAL;
323 if (cmd->phy_address != phydev->addr) 316 if (cmd->phy_address != phydev->addr)
324 goto unlock; 317 return -EINVAL;
325 318
326 if ((cmd->autoneg != AUTONEG_ENABLE) && 319 if ((cmd->autoneg != AUTONEG_ENABLE) &&
327 (cmd->autoneg != AUTONEG_DISABLE)) 320 (cmd->autoneg != AUTONEG_DISABLE))
328 goto unlock; 321 return -EINVAL;
329 322
330 if (cmd->autoneg == AUTONEG_DISABLE) { 323 if (cmd->autoneg == AUTONEG_DISABLE) {
331 switch (speed) { 324 switch (speed) {
@@ -334,16 +327,16 @@ static int xgbe_set_settings(struct net_device *netdev,
334 case SPEED_1000: 327 case SPEED_1000:
335 break; 328 break;
336 default: 329 default:
337 goto unlock; 330 return -EINVAL;
338 } 331 }
339 332
340 if (cmd->duplex != DUPLEX_FULL) 333 if (cmd->duplex != DUPLEX_FULL)
341 goto unlock; 334 return -EINVAL;
342 } 335 }
343 336
344 cmd->advertising &= phydev->supported; 337 cmd->advertising &= phydev->supported;
345 if ((cmd->autoneg == AUTONEG_ENABLE) && !cmd->advertising) 338 if ((cmd->autoneg == AUTONEG_ENABLE) && !cmd->advertising)
346 goto unlock; 339 return -EINVAL;
347 340
348 ret = 0; 341 ret = 0;
349 phydev->autoneg = cmd->autoneg; 342 phydev->autoneg = cmd->autoneg;
@@ -359,9 +352,6 @@ static int xgbe_set_settings(struct net_device *netdev,
359 if (netif_running(netdev)) 352 if (netif_running(netdev))
360 ret = phy_start_aneg(phydev); 353 ret = phy_start_aneg(phydev);
361 354
362unlock:
363 spin_unlock_irq(&pdata->lock);
364
365 DBGPR("<--xgbe_set_settings\n"); 355 DBGPR("<--xgbe_set_settings\n");
366 356
367 return ret; 357 return ret;
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
index 225f22d5fe0a..eecd360430a4 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
@@ -163,7 +163,6 @@ static void xgbe_adjust_link(struct net_device *netdev)
163 struct xgbe_prv_data *pdata = netdev_priv(netdev); 163 struct xgbe_prv_data *pdata = netdev_priv(netdev);
164 struct xgbe_hw_if *hw_if = &pdata->hw_if; 164 struct xgbe_hw_if *hw_if = &pdata->hw_if;
165 struct phy_device *phydev = pdata->phydev; 165 struct phy_device *phydev = pdata->phydev;
166 unsigned long flags;
167 int new_state = 0; 166 int new_state = 0;
168 167
169 if (phydev == NULL) 168 if (phydev == NULL)
@@ -172,8 +171,6 @@ static void xgbe_adjust_link(struct net_device *netdev)
172 DBGPR_MDIO("-->xgbe_adjust_link: address=%d, newlink=%d, curlink=%d\n", 171 DBGPR_MDIO("-->xgbe_adjust_link: address=%d, newlink=%d, curlink=%d\n",
173 phydev->addr, phydev->link, pdata->phy_link); 172 phydev->addr, phydev->link, pdata->phy_link);
174 173
175 spin_lock_irqsave(&pdata->lock, flags);
176
177 if (phydev->link) { 174 if (phydev->link) {
178 /* Flow control support */ 175 /* Flow control support */
179 if (pdata->pause_autoneg) { 176 if (pdata->pause_autoneg) {
@@ -229,8 +226,6 @@ static void xgbe_adjust_link(struct net_device *netdev)
229 if (new_state) 226 if (new_state)
230 phy_print_status(phydev); 227 phy_print_status(phydev);
231 228
232 spin_unlock_irqrestore(&pdata->lock, flags);
233
234 DBGPR_MDIO("<--xgbe_adjust_link\n"); 229 DBGPR_MDIO("<--xgbe_adjust_link\n");
235} 230}
236 231