netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] net: driver: stmicro: Remove some useless the lock protection
@ 2014-05-23 11:05 Wei.Yang
  2014-05-23 20:09 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Wei.Yang @ 2014-05-23 11:05 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, linux-kernel

From: Yang Wei <Wei.Yang@windriver.com>

kernel always invokes a pair of rtnl_lock adn rtnl_unlock to
protect dev_ethtool(), so its not neccessary to invoke spin_lock/unlock
in ethtool_ops.

Signed-off-by: Yang Wei <Wei.Yang@windriver.com>
---

 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |    8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index a49339d..a2f19e1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -231,9 +231,7 @@ static int stmmac_ethtool_getsettings(struct net_device *dev,
 		return -EBUSY;
 	}
 	cmd->transceiver = XCVR_INTERNAL;
-	spin_lock_irq(&priv->lock);
 	rc = phy_ethtool_gset(phy, cmd);
-	spin_unlock_irq(&priv->lock);
 	return rc;
 }
 
@@ -244,9 +242,7 @@ static int stmmac_ethtool_setsettings(struct net_device *dev,
 	struct phy_device *phy = priv->phydev;
 	int rc;
 
-	spin_lock(&priv->lock);
 	rc = phy_ethtool_sset(phy, cmd);
-	spin_unlock(&priv->lock);
 
 	return rc;
 }
@@ -313,7 +309,6 @@ stmmac_get_pauseparam(struct net_device *netdev,
 {
 	struct stmmac_priv *priv = netdev_priv(netdev);
 
-	spin_lock(&priv->lock);
 
 	pause->rx_pause = 0;
 	pause->tx_pause = 0;
@@ -324,7 +319,6 @@ stmmac_get_pauseparam(struct net_device *netdev,
 	if (priv->flow_ctrl & FLOW_TX)
 		pause->tx_pause = 1;
 
-	spin_unlock(&priv->lock);
 }
 
 static int
@@ -336,7 +330,6 @@ stmmac_set_pauseparam(struct net_device *netdev,
 	int new_pause = FLOW_OFF;
 	int ret = 0;
 
-	spin_lock(&priv->lock);
 
 	if (pause->rx_pause)
 		new_pause |= FLOW_RX;
@@ -352,7 +345,6 @@ stmmac_set_pauseparam(struct net_device *netdev,
 	} else
 		priv->hw->mac->flow_ctrl(priv->ioaddr, phy->duplex,
 					 priv->flow_ctrl, priv->pause);
-	spin_unlock(&priv->lock);
 	return ret;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] net: driver: stmicro: Remove some useless the lock protection
  2014-05-23 11:05 [PATCH v1] net: driver: stmicro: Remove some useless the lock protection Wei.Yang
@ 2014-05-23 20:09 ` David Miller
  2014-05-25  1:53   ` [PATCH v2] " Wei.Yang
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2014-05-23 20:09 UTC (permalink / raw)
  To: Wei.Yang; +Cc: peppe.cavallaro, netdev, linux-kernel

From: <Wei.Yang@windriver.com>
Date: Fri, 23 May 2014 19:05:03 +0800

> From: Yang Wei <Wei.Yang@windriver.com>
> 
> kernel always invokes a pair of rtnl_lock adn rtnl_unlock to
> protect dev_ethtool(), so its not neccessary to invoke spin_lock/unlock
> in ethtool_ops.
> 
> Signed-off-by: Yang Wei <Wei.Yang@windriver.com>

This does not apply cleanly to the net-next tree, please respin.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] net: driver: stmicro: Remove some useless the lock protection
  2014-05-23 20:09 ` David Miller
@ 2014-05-25  1:53   ` Wei.Yang
  2014-05-25  3:33     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Wei.Yang @ 2014-05-25  1:53 UTC (permalink / raw)
  To: davem; +Cc: peppe.cavallaro, wei.yang, netdev, linux-kernel

From: Yang Wei <Wei.Yang@windriver.com>

kernel always invokes a pair of rtnl_lock adn rtnl_unlock to
protect dev_ethtool(), so its not neccessary to invoke spin_lock/unlock
in ethtool_ops.

Signed-off-by: Yang Wei <Wei.Yang@windriver.com>
---
Hi David,

   I regenerate this patch based on net/next repo in v2.

Wei
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index c963394..7892666 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -322,9 +322,7 @@ static int stmmac_ethtool_getsettings(struct net_device *dev,
 		return -EBUSY;
 	}
 	cmd->transceiver = XCVR_INTERNAL;
-	spin_lock_irq(&priv->lock);
 	rc = phy_ethtool_gset(phy, cmd);
-	spin_unlock_irq(&priv->lock);
 	return rc;
 }
 
@@ -442,7 +440,6 @@ stmmac_get_pauseparam(struct net_device *netdev,
 	if (priv->flow_ctrl & FLOW_TX)
 		pause->tx_pause = 1;
 
-	spin_unlock(&priv->lock);
 }
 
 static int
@@ -457,8 +454,6 @@ stmmac_set_pauseparam(struct net_device *netdev,
 	if (priv->pcs)	/* FIXME */
 		return -EOPNOTSUPP;
 
-	spin_lock(&priv->lock);
-
 	if (pause->rx_pause)
 		new_pause |= FLOW_RX;
 	if (pause->tx_pause)
@@ -473,7 +468,6 @@ stmmac_set_pauseparam(struct net_device *netdev,
 	} else
 		priv->hw->mac->flow_ctrl(priv->ioaddr, phy->duplex,
 					 priv->flow_ctrl, priv->pause);
-	spin_unlock(&priv->lock);
 	return ret;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] net: driver: stmicro: Remove some useless the lock protection
  2014-05-25  1:53   ` [PATCH v2] " Wei.Yang
@ 2014-05-25  3:33     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-05-25  3:33 UTC (permalink / raw)
  To: Wei.Yang; +Cc: peppe.cavallaro, netdev, linux-kernel

From: <Wei.Yang@windriver.com>
Date: Sun, 25 May 2014 09:53:44 +0800

> From: Yang Wei <Wei.Yang@windriver.com>
> 
> kernel always invokes a pair of rtnl_lock adn rtnl_unlock to
> protect dev_ethtool(), so its not neccessary to invoke spin_lock/unlock
> in ethtool_ops.
> 
> Signed-off-by: Yang Wei <Wei.Yang@windriver.com>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-25  3:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23 11:05 [PATCH v1] net: driver: stmicro: Remove some useless the lock protection Wei.Yang
2014-05-23 20:09 ` David Miller
2014-05-25  1:53   ` [PATCH v2] " Wei.Yang
2014-05-25  3:33     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).