aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-07-23 00:51:36 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-07-26 14:17:01 -0400
commit633aae23ff31bef692a70772652e753a0ae59b81 (patch)
treec749165062fefa2cc6a5d5bdba0400ed290fa26f /drivers/input/serio
parentebd7768daeb39b0691e25175e25b980f13e913e2 (diff)
Input: serio - switch to using dev_pm_ops
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/serio.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index d66f4944f2a0..0236f0d5fd91 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -931,15 +931,11 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
931#endif /* CONFIG_HOTPLUG */ 931#endif /* CONFIG_HOTPLUG */
932 932
933#ifdef CONFIG_PM 933#ifdef CONFIG_PM
934static int serio_suspend(struct device *dev, pm_message_t state) 934static int serio_suspend(struct device *dev)
935{ 935{
936 struct serio *serio = to_serio_port(dev); 936 struct serio *serio = to_serio_port(dev);
937 937
938 if (!serio->suspended && state.event == PM_EVENT_SUSPEND) 938 serio_cleanup(serio);
939 serio_cleanup(serio);
940
941 serio->suspended = state.event == PM_EVENT_SUSPEND ||
942 state.event == PM_EVENT_FREEZE;
943 939
944 return 0; 940 return 0;
945} 941}
@@ -952,13 +948,17 @@ static int serio_resume(struct device *dev)
952 * Driver reconnect can take a while, so better let kseriod 948 * Driver reconnect can take a while, so better let kseriod
953 * deal with it. 949 * deal with it.
954 */ 950 */
955 if (serio->suspended) { 951 serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
956 serio->suspended = false;
957 serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
958 }
959 952
960 return 0; 953 return 0;
961} 954}
955
956static const struct dev_pm_ops serio_pm_ops = {
957 .suspend = serio_suspend,
958 .resume = serio_resume,
959 .poweroff = serio_suspend,
960 .restore = serio_resume,
961};
962#endif /* CONFIG_PM */ 962#endif /* CONFIG_PM */
963 963
964/* called from serio_driver->connect/disconnect methods under serio_mutex */ 964/* called from serio_driver->connect/disconnect methods under serio_mutex */
@@ -1015,8 +1015,7 @@ static struct bus_type serio_bus = {
1015 .remove = serio_driver_remove, 1015 .remove = serio_driver_remove,
1016 .shutdown = serio_shutdown, 1016 .shutdown = serio_shutdown,
1017#ifdef CONFIG_PM 1017#ifdef CONFIG_PM
1018 .suspend = serio_suspend, 1018 .pm = &serio_pm_ops,
1019 .resume = serio_resume,
1020#endif 1019#endif
1021}; 1020};
1022 1021