Skip to content

Commit 8c43a2c

Browse files
tlendackydavem330
authored andcommitted
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>
1 parent ae29223 commit 8c43a2c

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,9 @@ static int xgbe_get_settings(struct net_device *netdev,
290290
if (!pdata->phydev)
291291
return -ENODEV;
292292

293-
spin_lock_irq(&pdata->lock);
294-
295293
ret = phy_ethtool_gset(pdata->phydev, cmd);
296294
cmd->transceiver = XCVR_EXTERNAL;
297295

298-
spin_unlock_irq(&pdata->lock);
299-
300296
DBGPR("<--xgbe_get_settings\n");
301297

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

318-
spin_lock_irq(&pdata->lock);
319-
320314
speed = ethtool_cmd_speed(cmd);
321315

322-
ret = -EINVAL;
323316
if (cmd->phy_address != phydev->addr)
324-
goto unlock;
317+
return -EINVAL;
325318

326319
if ((cmd->autoneg != AUTONEG_ENABLE) &&
327320
(cmd->autoneg != AUTONEG_DISABLE))
328-
goto unlock;
321+
return -EINVAL;
329322

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

340333
if (cmd->duplex != DUPLEX_FULL)
341-
goto unlock;
334+
return -EINVAL;
342335
}
343336

344337
cmd->advertising &= phydev->supported;
345338
if ((cmd->autoneg == AUTONEG_ENABLE) && !cmd->advertising)
346-
goto unlock;
339+
return -EINVAL;
347340

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

362-
unlock:
363-
spin_unlock_irq(&pdata->lock);
364-
365355
DBGPR("<--xgbe_set_settings\n");
366356

367357
return ret;

drivers/net/ethernet/amd/xgbe/xgbe-mdio.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ static void xgbe_adjust_link(struct net_device *netdev)
163163
struct xgbe_prv_data *pdata = netdev_priv(netdev);
164164
struct xgbe_hw_if *hw_if = &pdata->hw_if;
165165
struct phy_device *phydev = pdata->phydev;
166-
unsigned long flags;
167166
int new_state = 0;
168167

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

175-
spin_lock_irqsave(&pdata->lock, flags);
176-
177174
if (phydev->link) {
178175
/* Flow control support */
179176
if (pdata->pause_autoneg) {
@@ -229,8 +226,6 @@ static void xgbe_adjust_link(struct net_device *netdev)
229226
if (new_state)
230227
phy_print_status(phydev);
231228

232-
spin_unlock_irqrestore(&pdata->lock, flags);
233-
234229
DBGPR_MDIO("<--xgbe_adjust_link\n");
235230
}
236231

0 commit comments

Comments
 (0)