Re: swsuspend not working

From: Pavel Machek
Date: Fri Aug 06 2004 - 14:08:12 EST


Hi!

> > > ? Destination Host Unreachable ? and nothing more. The interrupt count of
> > > the card is increasing, however. Unloading and reloading ne2k_pci fixes
> > > that.
> >
> > Teach ne2k_pci to do on suspend what it does on unload, and to do on
> > resume what it does on load. Should be easy.
>
> ? Should be easy ? is easily said. Well.

:-)))).

> The following patch to drivers/net/ne2k-pci.c in 2.6.8-rc1 happens to make
> my pci ethernet card (Realtek Semiconductor Co., Ltd. RTL-8029(AS))
> suspend to S4 and resume properly.
>
> I know nothing on suspend/resume architecture, I know nothing on
> programming ethernet card, I know nothing on patching device drivers; I
> just looked at other drivers, picked function calls that had nice looking
> names and put them together in ne2k_pci.c. Miraculously, it works.
>
> Do you think it could get in ?

Yes, the patch looks good to me, submit it through ne2k-pci
maintainer...

Pavel

> --- ne2k-pci.c.orig 2004-07-20 22:15:30.000000000 +0200
> +++ ne2k-pci.c 2004-07-31 19:48:38.000000000 +0200
> @@ -653,12 +653,43 @@
> pci_set_drvdata(pdev, NULL);
> }
>
> +#ifdef CONFIG_PM
> +static int ne2k_pci_suspend (struct pci_dev *pdev, u32 state)
> +{
> + struct net_device *dev = pci_get_drvdata (pdev);
> +
> + netif_device_detach(dev);
> + ne2k_pci_close(dev);
> + ne2k_pci_reset_8390(dev);
> + pci_set_power_state (pdev, state);
> +
> + return 0;
> +}
> +static int ne2k_pci_resume (struct pci_dev *pdev)
> +{
> + struct net_device *dev = pci_get_drvdata (pdev);
> +
> + pci_set_power_state(pdev, 0);
> + ne2k_pci_reset_8390(dev);
> + ne2k_pci_open(dev);
> + netif_device_attach(dev);
> +
> + return 0;
> +}
> +
> +#endif /* CONFIG_PM */
> +
>
> static struct pci_driver ne2k_driver = {
> .name = DRV_NAME,
> .probe = ne2k_pci_init_one,
> .remove = __devexit_p(ne2k_pci_remove_one),
> .id_table = ne2k_pci_tbl,
> +#ifdef CONFIG_PM
> + .suspend = ne2k_pci_suspend,
> + .resume = ne2k_pci_resume,
> +#endif /* CONFIG_PM */
> +
> };
>
>

--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/