netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 8139cp: Catch all interrupts
@ 2005-09-01 20:16 Pierre Ossman
  2005-10-31 18:14 ` Pierre Ossman
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Ossman @ 2005-09-01 20:16 UTC (permalink / raw)
  To: Jeff Garzik, LKML, netdev, Felipe Damasio

[-- Attachment #1: Type: text/plain, Size: 604 bytes --]

Register interrupt handler when net device is registered. Avoids missing
interrupts if the interrupt mask gets out of sync.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

---

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).

[-- Attachment #2: 8139cp-catch-irq.patch --]
[-- Type: text/x-patch, Size: 1327 bytes --]

Index: linux-wbsd/drivers/net/8139cp.c
===================================================================
--- linux-wbsd/drivers/net/8139cp.c	(revision 165)
+++ linux-wbsd/drivers/net/8139cp.c	(working copy)
@@ -1204,20 +1204,11 @@
 
 	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)
@@ -1238,7 +1229,6 @@
 	spin_unlock_irqrestore(&cp->lock, flags);
 
 	synchronize_irq(dev->irq);
-	free_irq(dev->irq, dev);
 
 	cp_free_rings(cp);
 	return 0;
@@ -1813,6 +1803,10 @@
 	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",
@@ -1832,6 +1826,8 @@
 
 	return 0;
 
+err_out_unreg:
+	unregister_netdev(dev);
 err_out_iomap:
 	iounmap(regs);
 err_out_res:
@@ -1852,6 +1848,7 @@
 
 	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);

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

* Re: [PATCH] 8139cp: Catch all interrupts
  2005-09-01 20:16 [PATCH] 8139cp: Catch all interrupts Pierre Ossman
@ 2005-10-31 18:14 ` Pierre Ossman
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre Ossman @ 2005-10-31 18:14 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: LKML, netdev, Felipe Damasio

Pierre Ossman wrote:
> Register interrupt handler when net device is registered. Avoids missing
> interrupts if the interrupt mask gets out of sync.
> 
> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
> 
> ---
> 
> 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).
> 

Any comments on this?

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

end of thread, other threads:[~2005-10-31 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-01 20:16 [PATCH] 8139cp: Catch all interrupts Pierre Ossman
2005-10-31 18:14 ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).