Re: revert yenta free_irq on suspend

Rafael J. Wysocki
2005-07-31T20:09:58Z

On Sunday, 31 of July 2005 01:09, Rafael J. Wysocki wrote:
> On Sunday, 31 of July 2005 00:24, Hugh Dickins wrote:
> > On Sun, 31 Jul 2005, Rafael J. Wysocki wrote:
> > > On Saturday, 30 of July 2005 23:32, Hugh Dickins wrote:
> > > > On Sat, 30 Jul 2005, Rafael J. Wysocki wrote:
> > > > >
> > > > > Could you please send the /proc/interrupts from your box?
> > > >
> > > > 11: 57443 XT-PIC yenta, yenta, eth0
> > >
> > > Thanks. It looks like eth0 gets a yenta's interrupt and goes awry.
> > > Could you please tell me what driver the eth0 is?
> >
> > CONFIG_VORTEX drivers/net/3c59x.c:
> > 0000:02:00.0: 3Com PCI 3c905C Tornado at 0xec80. Vers LK1.1.19
>
> Thanks again. From the first look the suspend/resume routines of the driver
> are missing some calls. In particular, with the IRQ-freeing patch for yenta it is
> likely to get an out-of-order interrupt as I suspected.
>
> Linus has apparently dropped that patch for yenta, but in case it is
> reintroduced in the future you will probably need a patch to make the network
> driver cooperate. I'll try to prepare one tomorrow, if I can, but I have no hardware
> to test it.

The patch follows. It compiles and should work, though I haven't tested it.

Greets,
Rafael

Index: linux-2.6.13-rc4-git3/drivers/net/3c59x.c
===================================================================
--- linux-2.6.13-rc4-git3.orig/drivers/net/3c59x.c
+++ linux-2.6.13-rc4-git3/drivers/net/3c59x.c
@@ -973,6 +973,11 @@ static int vortex_suspend (struct pci_de
netif_device_detach(dev);
vortex_down(dev, 1);
}
+ pci_save_state(pdev);
+ pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
+ free_irq(dev->irq, dev);
+ pci_disable_device(pdev);
+ pci_set_power_state(pdev, pci_choose_state(pdev, state));
}
return 0;
}
@@ -980,8 +985,19 @@ static int vortex_suspend (struct pci_de
static int vortex_resume (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
+ struct vortex_private *vp = netdev_priv(dev);

- if (dev && dev->priv) {
+ if (dev && vp) {
+ pci_set_power_state(pdev, PCI_D0);
+ pci_restore_state(pdev);
+ pci_enable_device(pdev);
+ pci_set_master(pdev);
+ if (request_irq(dev->irq, vp->full_bus_master_rx ?
+ &boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev)) {
+ printk(KERN_WARNING "%s: Could not reserve IRQ %d\n", dev->name, dev->irq);
+ pci_disable_device(pdev);
+ return -EBUSY;
+ }
if (netif_running(dev)) {
vortex_up(dev);
netif_device_attach(dev);

--
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
-- Lewis Carroll "Alice's Adventures in Wonderland"