diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2007-02-18 01:40:30 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2007-02-18 01:40:30 -0500 |
commit | 82dd9eff4bf3b17f5f511ae931a1f350c36ca9eb (patch) | |
tree | ccdd9581910720c07e7b1e0019278ea800671f24 /drivers/input/serio/serio.c | |
parent | a1cec06177386ecc320af643de11cfa77e8945bd (diff) | |
download | op-kernel-dev-82dd9eff4bf3b17f5f511ae931a1f350c36ca9eb.zip op-kernel-dev-82dd9eff4bf3b17f5f511ae931a1f350c36ca9eb.tar.gz |
Input: i8042 - let serio bus suspend ports
Let serio subsystem take care of suspending the ports; concentrate
on suspending/resuming the controller itself.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/serio/serio.c')
-rw-r--r-- | drivers/input/serio/serio.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 17c8c63c..a15e531 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -778,6 +778,19 @@ static int serio_driver_remove(struct device *dev) return 0; } +static void serio_cleanup(struct serio *serio) +{ + if (serio->drv && serio->drv->cleanup) + serio->drv->cleanup(serio); +} + +static void serio_shutdown(struct device *dev) +{ + struct serio *serio = to_serio_port(dev); + + serio_cleanup(serio); +} + static void serio_attach_driver(struct serio_driver *drv) { int error; @@ -910,11 +923,25 @@ static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buf #endif /* CONFIG_HOTPLUG */ +#ifdef CONFIG_PM +static int serio_suspend(struct device *dev, pm_message_t state) +{ + if (dev->power.power_state.event != state.event) { + if (state.event == PM_EVENT_SUSPEND) + serio_cleanup(to_serio_port(dev)); + + dev->power.power_state = state; + } + + return 0; +} + static int serio_resume(struct device *dev) { struct serio *serio = to_serio_port(dev); - if (serio_reconnect_driver(serio)) { + if (dev->power.power_state.event != PM_EVENT_ON && + serio_reconnect_driver(serio)) { /* * Driver re-probing can take a while, so better let kseriod * deal with it. @@ -922,8 +949,11 @@ static int serio_resume(struct device *dev) serio_rescan(serio); } + dev->power.power_state = PMSG_ON; + return 0; } +#endif /* CONFIG_PM */ /* called from serio_driver->connect/disconnect methods under serio_mutex */ int serio_open(struct serio *serio, struct serio_driver *drv) @@ -974,7 +1004,11 @@ static struct bus_type serio_bus = { .uevent = serio_uevent, .probe = serio_driver_probe, .remove = serio_driver_remove, + .shutdown = serio_shutdown, +#ifdef CONFIG_PM + .suspend = serio_suspend, .resume = serio_resume, +#endif }; static int __init serio_init(void) |