Skip to contentSkip to conversation

suspend/resume for the b44 driver

PATCH New Nicolae Mihalache 1 participant 1 message Sep 21, 2003 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PATCH 1/1 suspend/resume for the b44 driver

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

b44.c renamed from b44.c.orig +46 -0
@@ -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)