Commit 1a9f28c8 authored by Denis Kirjanov's avatar Denis Kirjanov Committed by David S. Miller

ns83820: Use helper to disable chip interrupts

Use helper routine to disable chip interrupts.
Signed-off-by: default avatarDenis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 875168a9
...@@ -1405,6 +1405,13 @@ static const struct ethtool_ops ops = { ...@@ -1405,6 +1405,13 @@ static const struct ethtool_ops ops = {
.get_link = ns83820_get_link .get_link = ns83820_get_link
}; };
static inline void ns83820_disable_interrupts(struct ns83820 *dev)
{
writel(0, dev->base + IMR);
writel(0, dev->base + IER);
readl(dev->base + IER);
}
/* this function is called in irq context from the ISR */ /* this function is called in irq context from the ISR */
static void ns83820_mib_isr(struct ns83820 *dev) static void ns83820_mib_isr(struct ns83820 *dev)
{ {
...@@ -1557,10 +1564,7 @@ static int ns83820_stop(struct net_device *ndev) ...@@ -1557,10 +1564,7 @@ static int ns83820_stop(struct net_device *ndev)
/* FIXME: protect against interrupt handler? */ /* FIXME: protect against interrupt handler? */
del_timer_sync(&dev->tx_watchdog); del_timer_sync(&dev->tx_watchdog);
/* disable interrupts */ ns83820_disable_interrupts(dev);
writel(0, dev->base + IMR);
writel(0, dev->base + IER);
readl(dev->base + IER);
dev->rx_info.up = 0; dev->rx_info.up = 0;
synchronize_irq(dev->pci_dev->irq); synchronize_irq(dev->pci_dev->irq);
...@@ -2023,10 +2027,7 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, ...@@ -2023,10 +2027,7 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev,
dev->tx_descs, (long)dev->tx_phy_descs, dev->tx_descs, (long)dev->tx_phy_descs,
dev->rx_info.descs, (long)dev->rx_info.phy_descs); dev->rx_info.descs, (long)dev->rx_info.phy_descs);
/* disable interrupts */ ns83820_disable_interrupts(dev);
writel(0, dev->base + IMR);
writel(0, dev->base + IER);
readl(dev->base + IER);
dev->IMR_cache = 0; dev->IMR_cache = 0;
...@@ -2250,9 +2251,7 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, ...@@ -2250,9 +2251,7 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev,
return 0; return 0;
out_cleanup: out_cleanup:
writel(0, dev->base + IMR); /* paranoia */ ns83820_disable_interrupts(dev); /* paranoia */
writel(0, dev->base + IER);
readl(dev->base + IER);
out_free_irq: out_free_irq:
rtnl_unlock(); rtnl_unlock();
free_irq(pci_dev->irq, ndev); free_irq(pci_dev->irq, ndev);
...@@ -2277,9 +2276,7 @@ static void __devexit ns83820_remove_one(struct pci_dev *pci_dev) ...@@ -2277,9 +2276,7 @@ static void __devexit ns83820_remove_one(struct pci_dev *pci_dev)
if (!ndev) /* paranoia */ if (!ndev) /* paranoia */
return; return;
writel(0, dev->base + IMR); /* paranoia */ ns83820_disable_interrupts(dev); /* paranoia */
writel(0, dev->base + IER);
readl(dev->base + IER);
unregister_netdev(ndev); unregister_netdev(ndev);
free_irq(dev->pci_dev->irq, ndev); free_irq(dev->pci_dev->irq, ndev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment