[PATCH] suspend/resume for the b44 driver

Nicolae Mihalache
2003-09-21T07:43:52Z

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

Hello,

This patch adds suspend/resume support for the Broadcom 4400 network
card. It has been tested with 2.6.0-test5-mm1 with suspend to disk
(suspend to ram does not work even without b44).

mache

[-- Attachment #2: b44.patch --]
[-- Type: text/plain, Size: 1263 bytes --]

--- b44.c.orig 2003-09-20 21:10:13.168315056 +0200
+++ b44.c 2003-09-20 21:13:54.567657240 +0200
@@ -1859,11 +1859,57 @@
}
}

+#ifdef CONFIG_PM
+static int b44_suspend(struct pci_dev *pdev, u32 state)
+{
+ struct net_device *dev = pci_get_drvdata(pdev);
+ struct b44 *bp = dev->priv;
+
+ if (!netif_running(dev))
+ return 0;
+
+ del_timer_sync(&bp->timer);
+
+ spin_lock_irq(&bp->lock);
+
+ b44_halt(bp);
+ netif_carrier_off(bp->dev);
+ netif_device_detach(bp->dev);
+ b44_free_rings(bp);
+
+ spin_unlock_irq(&bp->lock);
+ return 0;
+}
+
+static int b44_resume(struct pci_dev *pdev)
+{
+ struct net_device *dev = pci_get_drvdata(pdev);
+ struct b44 *bp = dev->priv;
+
+ if (!netif_running(dev))
+ return 0;
+
+ spin_lock_irq(&bp->lock);
+
+ b44_init_rings(bp);
+ b44_init_hw(bp);
+ netif_device_attach(bp->dev);
+ spin_unlock_irq(&bp->lock);
+
+ b44_enable_ints(bp);
+ return 0;
+}
+#endif /* CONFIG_PM */
+
static struct pci_driver b44_driver = {
.name = DRV_MODULE_NAME,
.id_table = b44_pci_tbl,
.probe = b44_init_one,
.remove = __devexit_p(b44_remove_one),
+#ifdef CONFIG_PM
+ .suspend = b44_suspend,
+ .resume = b44_resume,
+#endif /* CONFIG_PM */
};

static int __init b44_init(void)