PATCH (RESENT) swsuspend for ne2k-pci cards

From: Éric Brunet
Date: Wed Sep 01 2004 - 09:58:32 EST


Hi,

This is a resent of my patch to add suspend/resume support to ne2k-pci
network adapters.

* The patch was tested on a RealTek ne2k clone and works nicely,
* It was reviewed and largely improved by Arkadiusz Miskiewicz
* It was approved of by Pavel Machek, the software suspend maintainer.

It would be nice if this patch could go into the kernel.

Thank you,

Éric Brunet

--- linux-old/drivers/net/ne2k-pci.c 2004-08-07 15:54:24.000000000 +0200
+++ linux-2.6.8-rc1/drivers/net/ne2k-pci.c 2004-08-21 12:24:27.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);
+ pci_save_state(pdev, pdev->saved_config_space);
+ 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);
+ pci_restore_state(pdev, pdev->saved_config_space);
+ NS8390_init(dev, 1);
+ 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 */
+
};


-
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/