public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Vojtech Pavlik <vojtech@suse.cz>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: [patch 05/13] i8042: dont read CTR when resuming
Date: Sat, 28 May 2005 23:48:18 -0500	[thread overview]
Message-ID: <20050529045847.141124000.dtor_core@ameritech.net> (raw)
In-Reply-To: 20050529044813.711249000.dtor_core@ameritech.net

[-- Attachment #1: i8042-dont-read-ctr-when-resuming.patch --]
[-- Type: text/plain, Size: 2378 bytes --]

From: Vojtech Pavlik <vojtech@suse.cz>

Input: Only write the CTR in i8042 resume function. Reading it is
       wrong, since it may (will) contain nonsensical data.

Signed-off-by: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/input/serio/i8042.c |   48 +++++++++++++++++++++++++-------------------
 1 files changed, 28 insertions(+), 20 deletions(-)

Index: work/drivers/input/serio/i8042.c
===================================================================
--- work.orig/drivers/input/serio/i8042.c
+++ work/drivers/input/serio/i8042.c
@@ -698,6 +698,26 @@ static void i8042_timer_func(unsigned lo
 	i8042_interrupt(0, NULL, NULL);
 }
 
+static int i8042_ctl_test(void)
+{
+	unsigned char param;
+
+	if (!i8042_reset)
+		return 0;
+
+	if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
+		printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n");
+		return -1;
+	}
+
+	if (param != I8042_RET_CTL_TEST) {
+		printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n",
+			 param, I8042_RET_CTL_TEST);
+		return -1;
+	}
+
+	return 0;
+}
 
 /*
  * i8042_controller init initializes the i8042 controller, and,
@@ -719,21 +739,8 @@ static int i8042_controller_init(void)
 		return -1;
 	}
 
-	if (i8042_reset) {
-
-		unsigned char param;
-
-		if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
-			printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n");
-			return -1;
-		}
-
-		if (param != I8042_RET_CTL_TEST) {
-			printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n",
-				 param, I8042_RET_CTL_TEST);
-			return -1;
-		}
-	}
+	if (i8042_ctl_test())
+		return -1;
 
 /*
  * Save the CTR for restoral on unload / reboot.
@@ -806,9 +813,7 @@ static void i8042_controller_reset(void)
  * Reset the controller if requested.
  */
 
-	if (i8042_reset)
-		if (i8042_command(&param, I8042_CMD_CTL_TEST))
-			printk(KERN_ERR "i8042.c: i8042 controller reset timeout.\n");
+	i8042_ctl_test();
 
 /*
  * Disable MUX mode if present.
@@ -920,8 +925,11 @@ static int i8042_resume(struct device *d
 	if (level != RESUME_ENABLE)
 		return 0;
 
-	if (i8042_controller_init()) {
-		printk(KERN_ERR "i8042: resume failed\n");
+	if (i8042_ctl_test())
+		return -1;
+
+	if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
+		printk(KERN_ERR "i8042: Can't write CTR\n");
 		return -1;
 	}
 


  parent reply	other threads:[~2005-05-29  5:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-29  4:48 [patch 00/13] Input patches for 2.6.12 Dmitry Torokhov
2005-05-29  4:48 ` [patch 01/13] Fix a warning in psmouse-base.c Dmitry Torokhov
2005-05-29  4:48 ` [patch 02/13] gameport: implement stubs to make OSS drivers buildable Dmitry Torokhov
2005-05-29  4:48 ` [patch 03/13] i8042: try AUX (on x86) even if PNP only reports KBD Dmitry Torokhov
2005-05-29  4:48 ` [patch 04/13] i8042: remove unused variable Dmitry Torokhov
2005-05-29  4:48 ` Dmitry Torokhov [this message]
2005-05-29  4:48 ` [patch 06/13] i8042: tone down warning when PNP insists that KBC is missing Dmitry Torokhov
2005-05-29  4:48 ` [patch 07/13] i8042: Make sure we unregister PNP driver only once Dmitry Torokhov
2005-05-29  4:48 ` [patch 08/13] psmouse: workaround for Sunrex mouse Dmitry Torokhov
2005-05-29  4:48 ` [patch 09/13] joydev: fix button mapping Dmitry Torokhov
2005-05-29  4:48 ` [patch 10/13] gunze: fix out-of-bound array access Dmitry Torokhov
2005-05-29  4:48 ` [patch 11/13] i8042: dont activate MUX mode on Toshiba Satellite P10 Dmitry Torokhov
2005-05-29  4:48 ` [patch 12/13] i8042: dont activate MUX mode on Fujitsu Lifebook S6230 Dmitry Torokhov
2005-05-29  4:48 ` [patch 13/13] synaptics: be less verbose on startup Dmitry Torokhov
2005-05-29  7:37 ` [patch 14/13] Fix broken mapping for right "win" key Dmitry Torokhov
2005-05-29  7:51 ` [patch 00/13] Input patches for 2.6.12 Vojtech Pavlik

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=20050529045847.141124000.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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