public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Dmitry Torokhov <dtor@mail.ru>, Thomas Renninger <trenn@suse.de>
Subject: [patch 2/9] Backport of psmouse suspend/shutdown cleanups
Date: Mon, 26 Feb 2007 16:06:17 -0800	[thread overview]
Message-ID: <20070227000617.GC6283@kroah.com> (raw)
In-Reply-To: <20070227000538.GA6283@kroah.com>

[-- Attachment #1: backport-of-psmouse-suspend-shutdown-cleanups.patch --]
[-- Type: text/plain, Size: 2650 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Thomas Renninger <trenn@suse.de>

This patch works back to 2.6.17 (earlier kernels seem to
need up/down operations on mutex/semaphore).

psmouse - properly reset mouse on shutdown/suspend

Some people report that they need psmouse module unloaded
for suspend to ram/disk to work properly. Let's make port
cleanup behave the same way as driver unload.

This fixes "bad state" problem on various HP laptops, such
as nx7400.


Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/input/mouse/psmouse-base.c |   28 ++++++++++++++++++++++++++++
 drivers/input/mouse/psmouse.h      |    1 +
 drivers/input/mouse/synaptics.c    |    1 +
 3 files changed, 30 insertions(+)

--- linux-2.6.19.5.orig/drivers/input/mouse/psmouse-base.c
+++ linux-2.6.19.5/drivers/input/mouse/psmouse-base.c
@@ -986,8 +986,36 @@ static void psmouse_resync(void *p)
 static void psmouse_cleanup(struct serio *serio)
 {
 	struct psmouse *psmouse = serio_get_drvdata(serio);
+	struct psmouse *parent = NULL;
+
+	mutex_lock(&psmouse_mutex);
+
+	if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {
+		parent = serio_get_drvdata(serio->parent);
+		psmouse_deactivate(parent);
+	}
+
+	psmouse_deactivate(psmouse);
+
+	if (psmouse->cleanup)
+		psmouse->cleanup(psmouse);
 
 	psmouse_reset(psmouse);
+
+/*
+ * Some boxes, such as HP nx7400, get terribly confused if mouse
+ * is not fully enabled before suspending/shutting down.
+ */
+	ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
+
+	if (parent) {
+		if (parent->pt_deactivate)
+			parent->pt_deactivate(parent);
+
+		psmouse_activate(parent);
+	}
+
+	mutex_unlock(&psmouse_mutex);
 }
 
 /*
--- linux-2.6.19.5.orig/drivers/input/mouse/psmouse.h
+++ linux-2.6.19.5/drivers/input/mouse/psmouse.h
@@ -68,6 +68,7 @@ struct psmouse {
 
 	int (*reconnect)(struct psmouse *psmouse);
 	void (*disconnect)(struct psmouse *psmouse);
+	void (*cleanup)(struct psmouse *psmouse);
 	int (*poll)(struct psmouse *psmouse);
 
 	void (*pt_activate)(struct psmouse *psmouse);
--- linux-2.6.19.5.orig/drivers/input/mouse/synaptics.c
+++ linux-2.6.19.5/drivers/input/mouse/synaptics.c
@@ -652,6 +652,7 @@ int synaptics_init(struct psmouse *psmou
 	psmouse->set_rate = synaptics_set_rate;
 	psmouse->disconnect = synaptics_disconnect;
 	psmouse->reconnect = synaptics_reconnect;
+	psmouse->cleanup = synaptics_reset;
 	psmouse->pktsize = 6;
 	/* Synaptics can usually stay in sync without extra help */
 	psmouse->resync_time = 0;

--

  parent reply	other threads:[~2007-02-27  0:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070226235248.438556696@mini.kroah.org>
2007-02-27  0:05 ` [patch 0/9] 2.6.19-stable review Greg KH
2007-02-27  0:06   ` [patch 1/9] fix umask when noACL kernel meets extN tuned for ACLs Greg KH
2007-02-27  0:28     ` Andreas Gruenbacher
2007-02-27  0:06   ` Greg KH [this message]
2007-02-27  0:06   ` [patch 3/9] fix memory corruption from misinterpreted bad_inode_ops return values (CVE-2006-5753) Greg KH
2007-02-27  0:06   ` [patch 4/9] netpoll: drivers must not enable IRQ unconditionally in their NAPI handler Greg KH
2007-02-27  0:06   ` [patch 5/9] hda-intel - Dont try to probe invalid codecs Greg KH
2007-02-27  0:06   ` [patch 6/9] Fix oops when Windows server sent bad domain name null terminator Greg KH
2007-02-27  0:06   ` [patch 7/9] USB: usbnet driver bugfix Greg KH
2007-02-27  0:06   ` [patch 8/9] hda-codec - Dont return error at initialization of modem codec Greg KH
2007-02-27  0:06   ` [patch 9/9] Missing critical phys_to_virt in lib/swiotlb.c Greg KH
2007-02-27  2:47   ` [patch 0/9] 2.6.19-stable review (mmc: Power quirk for ENE controllers) Darren Salt
2007-02-27 20:23   ` [patch 0/9] 2.6.19-stable review Michael Krufky
2007-03-03  1:23     ` Greg KH
2007-03-03  1:48       ` Michael Krufky
2007-03-03  7:48         ` Greg KH

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=20070227000617.GC6283@kroah.com \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dtor@mail.ru \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=trenn@suse.de \
    --cc=tytso@mit.edu \
    --cc=zwane@arm.linux.org.uk \
    /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