All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] macb: Remove inappropriate spinlocks around mii calls
@ 2007-02-16 14:59 Haavard Skinnemoen
  2007-02-17 20:31 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Haavard Skinnemoen @ 2007-02-16 14:59 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: netdev, Andrew Victor, Patrice Vilchez, David Brownell,
	Haavard Skinnemoen

Remove spin_lock_irqsave() around mii_ethtool_gset, mii_ethtool_sset
and generic_mii_ioctl. These are unnecessary and harmful because
the mii calls may call back into the mdio functions, which may sleep.

Pointed out by David Brownell.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
 drivers/net/macb.c |   24 +++---------------------
 1 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index a41418b..2e9571b 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -881,27 +881,15 @@ static struct net_device_stats *macb_get_stats(struct net_device *dev)
 static int macb_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
 	struct macb *bp = netdev_priv(dev);
-	int ret;
-	unsigned long flags;
-
-	spin_lock_irqsave(&bp->lock, flags);
-	ret = mii_ethtool_gset(&bp->mii, cmd);
-	spin_unlock_irqrestore(&bp->lock, flags);
 
-	return ret;
+	return mii_ethtool_gset(&bp->mii, cmd);
 }
 
 static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
 	struct macb *bp = netdev_priv(dev);
-	int ret;
-	unsigned long flags;
-
-	spin_lock_irqsave(&bp->lock, flags);
-	ret = mii_ethtool_sset(&bp->mii, cmd);
-	spin_unlock_irqrestore(&bp->lock, flags);
 
-	return ret;
+	return mii_ethtool_sset(&bp->mii, cmd);
 }
 
 static void macb_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
@@ -930,17 +918,11 @@ static struct ethtool_ops macb_ethtool_ops = {
 static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct macb *bp = netdev_priv(dev);
-	int ret;
-	unsigned long flags;
 
 	if (!netif_running(dev))
 		return -EINVAL;
 
-	spin_lock_irqsave(&bp->lock, flags);
-	ret = generic_mii_ioctl(&bp->mii, if_mii(rq), cmd, NULL);
-	spin_unlock_irqrestore(&bp->lock, flags);
-
-	return ret;
+	return generic_mii_ioctl(&bp->mii, if_mii(rq), cmd, NULL);
 }
 
 static ssize_t macb_mii_show(const struct device *_dev, char *buf,
-- 
1.4.4.4


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

* Re: [PATCH] macb: Remove inappropriate spinlocks around mii calls
  2007-02-16 14:59 [PATCH] macb: Remove inappropriate spinlocks around mii calls Haavard Skinnemoen
@ 2007-02-17 20:31 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2007-02-17 20:31 UTC (permalink / raw)
  To: Haavard Skinnemoen; +Cc: netdev, Andrew Victor, Patrice Vilchez, David Brownell

Haavard Skinnemoen wrote:
> Remove spin_lock_irqsave() around mii_ethtool_gset, mii_ethtool_sset
> and generic_mii_ioctl. These are unnecessary and harmful because
> the mii calls may call back into the mdio functions, which may sleep.
> 
> Pointed out by David Brownell.
> 
> Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
> ---
>  drivers/net/macb.c |   24 +++---------------------
>  1 files changed, 3 insertions(+), 21 deletions(-)

applied



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

end of thread, other threads:[~2007-02-17 20:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-16 14:59 [PATCH] macb: Remove inappropriate spinlocks around mii calls Haavard Skinnemoen
2007-02-17 20:31 ` Jeff Garzik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.