macb: Remove inappropriate spinlocks around mii calls
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> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
committed by
Jeff Garzik
parent
daeafdc360
commit
140e807dd7
@@ -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)
|
static int macb_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||||
{
|
{
|
||||||
struct macb *bp = netdev_priv(dev);
|
struct macb *bp = netdev_priv(dev);
|
||||||
int ret;
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&bp->lock, flags);
|
return mii_ethtool_gset(&bp->mii, cmd);
|
||||||
ret = mii_ethtool_gset(&bp->mii, cmd);
|
|
||||||
spin_unlock_irqrestore(&bp->lock, flags);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||||
{
|
{
|
||||||
struct macb *bp = netdev_priv(dev);
|
struct macb *bp = netdev_priv(dev);
|
||||||
int ret;
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&bp->lock, flags);
|
return mii_ethtool_sset(&bp->mii, cmd);
|
||||||
ret = mii_ethtool_sset(&bp->mii, cmd);
|
|
||||||
spin_unlock_irqrestore(&bp->lock, flags);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void macb_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
|
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)
|
static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||||
{
|
{
|
||||||
struct macb *bp = netdev_priv(dev);
|
struct macb *bp = netdev_priv(dev);
|
||||||
int ret;
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
if (!netif_running(dev))
|
if (!netif_running(dev))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
spin_lock_irqsave(&bp->lock, flags);
|
return generic_mii_ioctl(&bp->mii, if_mii(rq), cmd, NULL);
|
||||||
ret = generic_mii_ioctl(&bp->mii, if_mii(rq), cmd, NULL);
|
|
||||||
spin_unlock_irqrestore(&bp->lock, flags);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t macb_mii_show(const struct device *_dev, char *buf,
|
static ssize_t macb_mii_show(const struct device *_dev, char *buf,
|
||||||
|
Reference in New Issue
Block a user