diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-05-09 19:08:05 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-05-09 19:10:18 -0400 |
commit | 7e044e056a6aa0dc695db50461d7b326fde15e8b (patch) | |
tree | bc0a26dbd140e54e1cfa9d67ad93ad890f50775f /drivers/input/serio | |
parent | 6f660f12d703fa23069317f0a64c6b75d08c15c2 (diff) |
Input: serio - do not use deprecated dev.power.power_state
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/serio')
-rw-r--r-- | drivers/input/serio/i8042.c | 17 | ||||
-rw-r--r-- | drivers/input/serio/serio.c | 37 |
2 files changed, 28 insertions, 26 deletions
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 3cffb704e374..f919bf57293c 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * the Free Software Foundation. | 10 | * the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/types.h> | ||
13 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
@@ -921,6 +922,9 @@ static void i8042_dritek_enable(void) | |||
921 | #endif | 922 | #endif |
922 | 923 | ||
923 | #ifdef CONFIG_PM | 924 | #ifdef CONFIG_PM |
925 | |||
926 | static bool i8042_suspended; | ||
927 | |||
924 | /* | 928 | /* |
925 | * Here we try to restore the original BIOS settings. We only want to | 929 | * Here we try to restore the original BIOS settings. We only want to |
926 | * do that once, when we really suspend, not when we taking memory | 930 | * do that once, when we really suspend, not when we taking memory |
@@ -930,11 +934,9 @@ static void i8042_dritek_enable(void) | |||
930 | 934 | ||
931 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) | 935 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) |
932 | { | 936 | { |
933 | if (dev->dev.power.power_state.event != state.event) { | 937 | if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) { |
934 | if (state.event == PM_EVENT_SUSPEND) | 938 | i8042_controller_reset(); |
935 | i8042_controller_reset(); | 939 | i8042_suspended = true; |
936 | |||
937 | dev->dev.power.power_state = state; | ||
938 | } | 940 | } |
939 | 941 | ||
940 | return 0; | 942 | return 0; |
@@ -952,7 +954,7 @@ static int i8042_resume(struct platform_device *dev) | |||
952 | /* | 954 | /* |
953 | * Do not bother with restoring state if we haven't suspened yet | 955 | * Do not bother with restoring state if we haven't suspened yet |
954 | */ | 956 | */ |
955 | if (dev->dev.power.power_state.event == PM_EVENT_ON) | 957 | if (!i8042_suspended) |
956 | return 0; | 958 | return 0; |
957 | 959 | ||
958 | error = i8042_controller_check(); | 960 | error = i8042_controller_check(); |
@@ -998,10 +1000,9 @@ static int i8042_resume(struct platform_device *dev) | |||
998 | if (i8042_ports[I8042_KBD_PORT_NO].serio) | 1000 | if (i8042_ports[I8042_KBD_PORT_NO].serio) |
999 | i8042_enable_kbd_port(); | 1001 | i8042_enable_kbd_port(); |
1000 | 1002 | ||
1003 | i8042_suspended = false; | ||
1001 | i8042_interrupt(0, NULL); | 1004 | i8042_interrupt(0, NULL); |
1002 | 1005 | ||
1003 | dev->dev.power.power_state = PMSG_ON; | ||
1004 | |||
1005 | return 0; | 1006 | return 0; |
1006 | } | 1007 | } |
1007 | #endif /* CONFIG_PM */ | 1008 | #endif /* CONFIG_PM */ |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 8d2df5d2d5a2..fb17573f8f2d 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -495,9 +495,9 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute * | |||
495 | 495 | ||
496 | retval = count; | 496 | retval = count; |
497 | if (!strncmp(buf, "manual", count)) { | 497 | if (!strncmp(buf, "manual", count)) { |
498 | serio->manual_bind = 1; | 498 | serio->manual_bind = true; |
499 | } else if (!strncmp(buf, "auto", count)) { | 499 | } else if (!strncmp(buf, "auto", count)) { |
500 | serio->manual_bind = 0; | 500 | serio->manual_bind = false; |
501 | } else { | 501 | } else { |
502 | retval = -EINVAL; | 502 | retval = -EINVAL; |
503 | } | 503 | } |
@@ -570,7 +570,7 @@ static void serio_add_port(struct serio *serio) | |||
570 | "serio: device_add() failed for %s (%s), error: %d\n", | 570 | "serio: device_add() failed for %s (%s), error: %d\n", |
571 | serio->phys, serio->name, error); | 571 | serio->phys, serio->name, error); |
572 | else { | 572 | else { |
573 | serio->registered = 1; | 573 | serio->registered = true; |
574 | error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); | 574 | error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); |
575 | if (error) | 575 | if (error) |
576 | printk(KERN_ERR | 576 | printk(KERN_ERR |
@@ -606,7 +606,7 @@ static void serio_destroy_port(struct serio *serio) | |||
606 | if (serio->registered) { | 606 | if (serio->registered) { |
607 | sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); | 607 | sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); |
608 | device_del(&serio->dev); | 608 | device_del(&serio->dev); |
609 | serio->registered = 0; | 609 | serio->registered = false; |
610 | } | 610 | } |
611 | 611 | ||
612 | list_del_init(&serio->node); | 612 | list_del_init(&serio->node); |
@@ -750,9 +750,9 @@ static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char | |||
750 | 750 | ||
751 | retval = count; | 751 | retval = count; |
752 | if (!strncmp(buf, "manual", count)) { | 752 | if (!strncmp(buf, "manual", count)) { |
753 | serio_drv->manual_bind = 1; | 753 | serio_drv->manual_bind = true; |
754 | } else if (!strncmp(buf, "auto", count)) { | 754 | } else if (!strncmp(buf, "auto", count)) { |
755 | serio_drv->manual_bind = 0; | 755 | serio_drv->manual_bind = false; |
756 | } else { | 756 | } else { |
757 | retval = -EINVAL; | 757 | retval = -EINVAL; |
758 | } | 758 | } |
@@ -812,7 +812,7 @@ static void serio_attach_driver(struct serio_driver *drv) | |||
812 | 812 | ||
813 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) | 813 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) |
814 | { | 814 | { |
815 | int manual_bind = drv->manual_bind; | 815 | bool manual_bind = drv->manual_bind; |
816 | int error; | 816 | int error; |
817 | 817 | ||
818 | drv->driver.bus = &serio_bus; | 818 | drv->driver.bus = &serio_bus; |
@@ -823,7 +823,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons | |||
823 | * Temporarily disable automatic binding because probing | 823 | * Temporarily disable automatic binding because probing |
824 | * takes long time and we are better off doing it in kseriod | 824 | * takes long time and we are better off doing it in kseriod |
825 | */ | 825 | */ |
826 | drv->manual_bind = 1; | 826 | drv->manual_bind = true; |
827 | 827 | ||
828 | error = driver_register(&drv->driver); | 828 | error = driver_register(&drv->driver); |
829 | if (error) { | 829 | if (error) { |
@@ -838,7 +838,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons | |||
838 | * driver to free ports | 838 | * driver to free ports |
839 | */ | 839 | */ |
840 | if (!manual_bind) { | 840 | if (!manual_bind) { |
841 | drv->manual_bind = 0; | 841 | drv->manual_bind = false; |
842 | error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER); | 842 | error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER); |
843 | if (error) { | 843 | if (error) { |
844 | driver_unregister(&drv->driver); | 844 | driver_unregister(&drv->driver); |
@@ -856,7 +856,7 @@ void serio_unregister_driver(struct serio_driver *drv) | |||
856 | 856 | ||
857 | mutex_lock(&serio_mutex); | 857 | mutex_lock(&serio_mutex); |
858 | 858 | ||
859 | drv->manual_bind = 1; /* so serio_find_driver ignores it */ | 859 | drv->manual_bind = true; /* so serio_find_driver ignores it */ |
860 | serio_remove_pending_events(drv); | 860 | serio_remove_pending_events(drv); |
861 | 861 | ||
862 | start_over: | 862 | start_over: |
@@ -933,11 +933,11 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
933 | #ifdef CONFIG_PM | 933 | #ifdef CONFIG_PM |
934 | static int serio_suspend(struct device *dev, pm_message_t state) | 934 | static int serio_suspend(struct device *dev, pm_message_t state) |
935 | { | 935 | { |
936 | if (dev->power.power_state.event != state.event) { | 936 | struct serio *serio = to_serio_port(dev); |
937 | if (state.event == PM_EVENT_SUSPEND) | ||
938 | serio_cleanup(to_serio_port(dev)); | ||
939 | 937 | ||
940 | dev->power.power_state = state; | 938 | if (!serio->suspended && state.event == PM_EVENT_SUSPEND) { |
939 | serio_cleanup(serio); | ||
940 | serio->suspended = true; | ||
941 | } | 941 | } |
942 | 942 | ||
943 | return 0; | 943 | return 0; |
@@ -945,14 +945,15 @@ static int serio_suspend(struct device *dev, pm_message_t state) | |||
945 | 945 | ||
946 | static int serio_resume(struct device *dev) | 946 | static int serio_resume(struct device *dev) |
947 | { | 947 | { |
948 | struct serio *serio = to_serio_port(dev); | ||
949 | |||
948 | /* | 950 | /* |
949 | * Driver reconnect can take a while, so better let kseriod | 951 | * Driver reconnect can take a while, so better let kseriod |
950 | * deal with it. | 952 | * deal with it. |
951 | */ | 953 | */ |
952 | if (dev->power.power_state.event != PM_EVENT_ON) { | 954 | if (serio->suspended) { |
953 | dev->power.power_state = PMSG_ON; | 955 | serio->suspended = false; |
954 | serio_queue_event(to_serio_port(dev), NULL, | 956 | serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT); |
955 | SERIO_RECONNECT_PORT); | ||
956 | } | 957 | } |
957 | 958 | ||
958 | return 0; | 959 | return 0; |