From: Pierre Ossman <[EMAIL PROTECTED]>

Avoids missing interrupts if the interrupt mask gets out of sync.

The reason this patch is needed for me is that the resume function is
broken.  It enables interrupts unconditionally, but the interrupt handler
is only registered when the device is up.

I don't have enough knowledge about the driver to fix the resume function
so this patch will instead make sure that the interrupt handler is
registered at all times (which can be a nice safeguard even when the resume
function gets fixed).

(akpm: carry this in -mm pending a fix of the resume function)

Signed-off-by: Pierre Ossman <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/net/8139cp.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff -puN 
drivers/net/8139cp.c~8139cp-register-interrupt-handler-when-net-device-is-registered
 drivers/net/8139cp.c
--- 
devel/drivers/net/8139cp.c~8139cp-register-interrupt-handler-when-net-device-is-registered
  2006-03-08 00:05:51.000000000 -0800
+++ devel-akpm/drivers/net/8139cp.c     2006-03-08 00:05:51.000000000 -0800
@@ -1201,20 +1201,11 @@ static int cp_open (struct net_device *d
 
        cp_init_hw(cp);
 
-       rc = request_irq(dev->irq, cp_interrupt, SA_SHIRQ, dev->name, dev);
-       if (rc)
-               goto err_out_hw;
-
        netif_carrier_off(dev);
        mii_check_media(&cp->mii_if, netif_msg_link(cp), TRUE);
        netif_start_queue(dev);
 
        return 0;
-
-err_out_hw:
-       cp_stop_hw(cp);
-       cp_free_rings(cp);
-       return rc;
 }
 
 static int cp_close (struct net_device *dev)
@@ -1235,7 +1226,6 @@ static int cp_close (struct net_device *
        spin_unlock_irqrestore(&cp->lock, flags);
 
        synchronize_irq(dev->irq);
-       free_irq(dev->irq, dev);
 
        cp_free_rings(cp);
        return 0;
@@ -1819,6 +1809,10 @@ static int cp_init_one (struct pci_dev *
        if (rc)
                goto err_out_iomap;
 
+       rc = request_irq(dev->irq, cp_interrupt, SA_SHIRQ, dev->name, dev);
+       if (rc)
+               goto err_out_unreg;
+
        printk (KERN_INFO "%s: RTL-8139C+ at 0x%lx, "
                "%02x:%02x:%02x:%02x:%02x:%02x, "
                "IRQ %d\n",
@@ -1838,6 +1832,8 @@ static int cp_init_one (struct pci_dev *
 
        return 0;
 
+err_out_unreg:
+       unregister_netdev(dev);
 err_out_iomap:
        iounmap(regs);
 err_out_res:
@@ -1858,6 +1854,7 @@ static void cp_remove_one (struct pci_de
 
        if (!dev)
                BUG();
+       free_irq(dev->irq, dev);
        unregister_netdev(dev);
        iounmap(cp->regs);
        if (cp->wol_enabled) pci_set_power_state (pdev, PCI_D0);
_
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to