Diff of /drivers/input/si/gcn-si.c [3f1531] .. [aa2218] Maximize Restore

  Switch to side-by-side view

--- a/drivers/input/si/gcn-si.c
+++ b/drivers/input/si/gcn-si.c
@@ -114,6 +114,9 @@
 };
 
 struct si_drvdata {
+	unsigned long flags;
+#define SI_QUIESCE	(1<<0)
+
 	struct si_port ports[SI_MAX_PORTS];
 
 	void __iomem *io_base;
@@ -127,7 +130,7 @@
 static int si_force_keyboard_port = -1;
 
 #ifdef MODULE
-module_psi_named(force_keyboard_port, si_force_keyboard_port, int, 0644);
+module_param_named(force_keyboard_port, si_force_keyboard_port, int, 0644);
 MODULE_PARM_DESC(force_keyboard_port, "port n becomes a keyboard port if"
 		 " automatic identification fails");
 #else
@@ -148,7 +151,7 @@
  *
  */
 
-static void si_reset(void __iomem *io_base)
+static void si_reset_all(void __iomem *io_base)
 {
 	int i;
 
@@ -351,7 +354,8 @@
 
 	input_sync(port->idev);
 
-	mod_timer(&port->timer, jiffies + SI_REFRESH_TIME);
+	if (!(port->drvdata->flags & SI_QUIESCE))
+		mod_timer(&port->timer, jiffies + SI_REFRESH_TIME);
 }
 
 /*
@@ -486,8 +490,6 @@
 	void __iomem *io_base = port->drvdata->io_base;
 	struct input_dev *idev;
 	int retval = 0;
-
-	si_reset(io_base);
 
 	/*
 	 * Determine input device type from SI id.
@@ -577,6 +579,7 @@
 
 	drvdata->io_base = ioremap(mem->start, mem->end - mem->start + 1);
 
+	si_reset_all(drvdata->io_base);
 	for (index = 0; index < SI_MAX_PORTS; ++index) {
 		port = &drvdata->ports[index];
 
@@ -659,6 +662,20 @@
 	return -ENODEV;
 }
 
+static int si_do_shutdown(struct device *dev)
+{
+	struct si_drvdata *drvdata = dev_get_drvdata(dev);
+	int i;
+
+	if (drvdata) {
+		drvdata->flags |= SI_QUIESCE;
+		for (i = 0; i < SI_MAX_PORTS; ++i)
+			del_timer_sync(&drvdata->ports[i].timer);
+		si_reset_all(drvdata->io_base);
+	}
+	return 0;
+}
+
 
 /*
  * OF platform driver hooks.
@@ -683,6 +700,11 @@
 static int __exit si_of_remove(struct of_device *odev)
 {
 	return si_do_remove(&odev->dev);
+}
+
+static int si_of_shutdown(struct of_device *odev)
+{
+	return si_do_shutdown(&odev->dev);
 }
 
 static struct of_device_id si_of_match[] = {
@@ -700,6 +722,7 @@
 	.match_table = si_of_match,
 	.probe = si_of_probe,
 	.remove = si_of_remove,
+	.shutdown = si_of_shutdown,
 };