aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-03-03 11:47:40 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-03-25 10:37:26 -0700
commit5ea1320653359dd2ade7ff2ad81e37b790eb1f1f (patch)
tree7740530f6ba6f258c79e41e869d0e62b52840a9d /drivers/input/serio
parentInput: synaptics - do not mix logical and bitwise operations (diff)
downloadlinux-dev-5ea1320653359dd2ade7ff2ad81e37b790eb1f1f.tar.xz
linux-dev-5ea1320653359dd2ade7ff2ad81e37b790eb1f1f.zip
Input: serio - add fast reconnect option
Devices connected to serio bus are quite slow, and to improve apparent speed of resume process, serio core resumes (reconnects) its devices asynchronously, by posting port reconnect requests to a workqueue. Unfortunately this means that if there is a dependent device of a given serio port (for example SMBus part of touchpad connected via both PS/2 and SMBus), we do not have a good way of ensuring resume order. This change allows drivers to define "fast reconnect" handlers that would be called in-line during system resume. Drivers need to ensure that these handlers are truly "fast". Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/serio.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 048ae748c4d1..30d6230d48f7 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -953,12 +953,24 @@ static int serio_suspend(struct device *dev)
static int serio_resume(struct device *dev)
{
struct serio *serio = to_serio_port(dev);
+ int error = -ENOENT;
- /*
- * Driver reconnect can take a while, so better let kseriod
- * deal with it.
- */
- serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
+ mutex_lock(&serio->drv_mutex);
+ if (serio->drv && serio->drv->fast_reconnect) {
+ error = serio->drv->fast_reconnect(serio);
+ if (error && error != -ENOENT)
+ dev_warn(dev, "fast reconnect failed with error %d\n",
+ error);
+ }
+ mutex_unlock(&serio->drv_mutex);
+
+ if (error) {
+ /*
+ * Driver reconnect can take a while, so better let
+ * kseriod deal with it.
+ */
+ serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
+ }
return 0;
}