summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2012-08-02 18:13:17 +0000
committerFlorian Fainelli <florian@openwrt.org>2012-08-02 18:13:17 +0000
commit162e272b4b2b770cd5eb97006bb4ff99b09bd8de (patch)
treef866a780195866de338987d94cd8bf4ce7c4ae61 /target
parentf45132d1d444ec33df3938e3e2a78ebee750ed8b (diff)
downloadmtk-20170518-162e272b4b2b770cd5eb97006bb4ff99b09bd8de.zip
mtk-20170518-162e272b4b2b770cd5eb97006bb4ff99b09bd8de.tar.gz
mtk-20170518-162e272b4b2b770cd5eb97006bb4ff99b09bd8de.tar.bz2
nuport-mac: properly protect the phy interrupt handler
SVN-Revision: 32951
Diffstat (limited to 'target')
-rw-r--r--target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c b/target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c
index 657fb6a..794987f 100644
--- a/target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c
+++ b/target/linux/mcs814x/files-3.3/drivers/net/ethernet/mcs8140/nuport_mac.c
@@ -422,19 +422,25 @@ static irqreturn_t nuport_mac_link_interrupt(int irq, void *dev_id)
struct nuport_mac_priv *priv = netdev_priv(dev);
u32 reg;
u8 phy_addr;
+ unsigned long flags;
+ irqreturn_t ret = IRQ_HANDLED;
+ spin_lock_irqsave(&priv->lock, flags);
reg = nuport_mac_readl(LINK_INT_CSR);
phy_addr = (reg >> LINK_PHY_ADDR_SHIFT) & (PHY_MAX_ADDR - 1);
if (phy_addr != priv->phydev->addr) {
netdev_err(dev, "spurious PHY irq (phy: %d)\n", phy_addr);
- return IRQ_NONE;
+ ret = IRQ_NONE;
+ goto out;
}
priv->phydev->link = (reg & LINK_UP);
nuport_mac_adjust_link(dev);
- return IRQ_HANDLED;
+out:
+ spin_unlock_irqrestore(&priv->lock, flags);
+ return ret;
}
static irqreturn_t nuport_mac_tx_interrupt(int irq, void *dev_id)