mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 5/7] Input: i8042 remove old-style PM handling
Date: Thu, 21 Oct 2004 02:28:55 -0500	[thread overview]
Message-ID: <200410210228.57067.dtor_core@ameritech.net> (raw)
In-Reply-To: <200410210228.03038.dtor_core@ameritech.net>


===================================================================


ChangeSet@1.1968, 2004-10-20 00:40:19-05:00, dtor_core@ameritech.net
  Input: i8042 - get rid of old-style power management handler since
         AMP calls both pm_send and device_suspend.
  
  Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


 i8042.c |   89 +++++++++++++++++++++-------------------------------------------
 1 files changed, 30 insertions(+), 59 deletions(-)


===================================================================



diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c	2004-10-21 02:13:12 -05:00
+++ b/drivers/input/serio/i8042.c	2004-10-21 02:13:12 -05:00
@@ -113,7 +113,6 @@
 static unsigned char i8042_ctr;
 static unsigned char i8042_mux_open;
 static unsigned char i8042_mux_present;
-static struct pm_dev *i8042_pm_dev;
 static struct timer_list i8042_timer;
 static struct platform_device *i8042_platform_device;
 
@@ -826,13 +825,36 @@
 
 
 /*
+ * We need to reset the 8042 back to original mode on system shutdown,
+ * because otherwise BIOSes will be confused.
+ */
+
+static int i8042_notify_sys(struct notifier_block *this, unsigned long code,
+        		    void *unused)
+{
+        if (code == SYS_DOWN || code == SYS_HALT)
+        	i8042_controller_cleanup();
+        return NOTIFY_DONE;
+}
+
+static struct notifier_block i8042_notifier =
+{
+        i8042_notify_sys,
+        NULL,
+        0
+};
+
+
+/*
  * Here we try to restore the original BIOS settings
  */
 
-static int i8042_controller_suspend(void)
+static int i8042_suspend(struct device *dev, u32 state, u32 level)
 {
-	del_timer_sync(&i8042_timer);
-	i8042_controller_reset();
+	if (level == SUSPEND_DISABLE) {
+		del_timer_sync(&i8042_timer);
+		i8042_controller_reset();
+	}
 
 	return 0;
 }
@@ -842,10 +864,13 @@
  * Here we try to reset everything back to a state in which suspended
  */
 
-static int i8042_controller_resume(void)
+static int i8042_resume(struct device *dev, u32 level)
 {
 	int i;
 
+	if (level != RESUME_ENABLE)
+		return 0;
+
 	if (i8042_controller_init()) {
 		printk(KERN_ERR "i8042: resume failed\n");
 		return -1;
@@ -876,40 +901,7 @@
 	mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);
 
 	return 0;
-}
-
-
-/*
- * We need to reset the 8042 back to original mode on system shutdown,
- * because otherwise BIOSes will be confused.
- */
 
-static int i8042_notify_sys(struct notifier_block *this, unsigned long code,
-        		    void *unused)
-{
-        if (code == SYS_DOWN || code == SYS_HALT)
-        	i8042_controller_cleanup();
-        return NOTIFY_DONE;
-}
-
-static struct notifier_block i8042_notifier =
-{
-        i8042_notify_sys,
-        NULL,
-        0
-};
-
-/*
- * Suspend/resume handlers for the new PM scheme (driver model)
- */
-static int i8042_suspend(struct device *dev, u32 state, u32 level)
-{
-	return level == SUSPEND_DISABLE ? i8042_controller_suspend() : 0;
-}
-
-static int i8042_resume(struct device *dev, u32 level)
-{
-	return level == RESUME_ENABLE ? i8042_controller_resume() : 0;
 }
 
 static void i8042_shutdown(struct device *dev)
@@ -925,22 +917,6 @@
 	.shutdown	= i8042_shutdown,
 };
 
-/*
- * Suspend/resume handler for the old PM scheme (APM)
- */
-static int i8042_pm_callback(struct pm_dev *dev, pm_request_t request, void *dummy)
-{
-	switch (request) {
-		case PM_SUSPEND:
-			return i8042_controller_suspend();
-
-		case PM_RESUME:
-			return i8042_controller_resume();
-	}
-
-	return 0;
-}
-
 static struct serio * __init i8042_allocate_kbd_port(void)
 {
 	struct serio *serio;
@@ -1055,8 +1031,6 @@
 
 	mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);
 
-	i8042_pm_dev = pm_register(PM_SYS_DEV, PM_SYS_UNKNOWN, i8042_pm_callback);
-
 	register_reboot_notifier(&i8042_notifier);
 
 	return 0;
@@ -1067,9 +1041,6 @@
 	int i;
 
 	unregister_reboot_notifier(&i8042_notifier);
-
-	if (i8042_pm_dev)
-		pm_unregister(i8042_pm_dev);
 
 	i8042_controller_cleanup();
 

  reply	other threads:[~2004-10-21  7:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-21  7:23 [PATCH 0/7] New input patches Dmitry Torokhov
2004-10-21  7:24 ` [PATCH 1/7] Input: whitespace fixes Dmitry Torokhov
2004-10-21  7:25   ` [PATCH 2/7] Input: remove class devices on disconnect Dmitry Torokhov
2004-10-21  7:26     ` [PATCH 3/7] Input: link input_dev and serio (sysfs) Dmitry Torokhov
2004-10-21  7:28       ` [PATCH 4/7] Input: i8042 runtime debug switch Dmitry Torokhov
2004-10-21  7:28         ` Dmitry Torokhov [this message]
2004-10-21  7:29           ` [PATCH 6/7] Input: i8042 remove reboot notifier Dmitry Torokhov
2004-10-21  7:30             ` [PATCH 7/7] Input: remove pm_dev from core Dmitry Torokhov
2004-10-21  9:13               ` Russell King
2004-10-21 13:25                 ` Dmitry Torokhov
2004-10-23 20:49                   ` Russell King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200410210228.57067.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome