Skip to contentSkip to conversation

make 8250_pnp serial driver work after suspend to ram

PATCH New Mike Galbraith 1 participant 1 message Nov 29, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make 8250_pnp serial driver work after suspend to ram

Add suspend/resume methods to drivers/serial/8250_pnp.c. Tested on a P4/HT 16550A box, ttyS0 login survives across suspend to ram.

drivers/serial/8250_pnp.c renamed from drivers/serial/8250_pnp.c.org +28 -1
@@ -464,11 +464,38 @@ static void __devexit serial_pnp_remove(
 		serial8250_unregister_port(line - 1);
 }
 
+#ifdef CONFIG_PM
+static int serial_pnp_suspend(struct pnp_dev *dev, pm_message_t state)
+{
+	long line = (long)pnp_get_drvdata(dev);
+
+	if (!line)
+		return -ENODEV;
+	serial8250_suspend_port(line - 1);
+	return 0;
+}
+
+static int serial_pnp_resume(struct pnp_dev *dev)
+{
+	long line = (long)pnp_get_drvdata(dev);
+
+	if (!line)
+		return -ENODEV;
+	serial8250_resume_port(line - 1);
+	return 0;
+}
+
+#endif /* CONFIG_PM */
+
 static struct pnp_driver serial_pnp_driver = {
 	.name		= "serial",
-	.id_table	= pnp_dev_table,
 	.probe		= serial_pnp_probe,
 	.remove		= __devexit_p(serial_pnp_remove),
+#ifdef CONFIG_PM
+	.suspend	= serial_pnp_suspend,
+	.resume		= serial_pnp_resume,
+#endif
+	.id_table	= pnp_dev_table,
 };
 
 static int __init serial8250_pnp_init(void)