aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/gameport/gameport.c6
-rw-r--r--drivers/input/serio/i8042.c17
-rw-r--r--drivers/input/serio/serio.c37
-rw-r--r--include/linux/gameport.h3
-rw-r--r--include/linux/serio.h9
5 files changed, 39 insertions, 33 deletions
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 0279d6983cc8..ac11be08585e 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -723,7 +723,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner
723 * Temporarily disable automatic binding because probing 723 * Temporarily disable automatic binding because probing
724 * takes long time and we are better off doing it in kgameportd 724 * takes long time and we are better off doing it in kgameportd
725 */ 725 */
726 drv->ignore = 1; 726 drv->ignore = true;
727 727
728 error = driver_register(&drv->driver); 728 error = driver_register(&drv->driver);
729 if (error) { 729 if (error) {
@@ -736,7 +736,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner
736 /* 736 /*
737 * Reset ignore flag and let kgameportd bind the driver to free ports 737 * Reset ignore flag and let kgameportd bind the driver to free ports
738 */ 738 */
739 drv->ignore = 0; 739 drv->ignore = false;
740 error = gameport_queue_event(drv, NULL, GAMEPORT_ATTACH_DRIVER); 740 error = gameport_queue_event(drv, NULL, GAMEPORT_ATTACH_DRIVER);
741 if (error) { 741 if (error) {
742 driver_unregister(&drv->driver); 742 driver_unregister(&drv->driver);
@@ -753,7 +753,7 @@ void gameport_unregister_driver(struct gameport_driver *drv)
753 753
754 mutex_lock(&gameport_mutex); 754 mutex_lock(&gameport_mutex);
755 755
756 drv->ignore = 1; /* so gameport_find_driver ignores it */ 756 drv->ignore = true; /* so gameport_find_driver ignores it */
757 gameport_remove_pending_events(drv); 757 gameport_remove_pending_events(drv);
758 758
759start_over: 759start_over:
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
926static 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
931static int i8042_suspend(struct platform_device *dev, pm_message_t state) 935static 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
813int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) 813int __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
862start_over: 862start_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
934static int serio_suspend(struct device *dev, pm_message_t state) 934static 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
946static int serio_resume(struct device *dev) 946static 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;
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 0cd825f7363a..1bc08541c2b9 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -11,6 +11,7 @@
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#include <asm/io.h> 13#include <asm/io.h>
14#include <linux/types.h>
14#include <linux/list.h> 15#include <linux/list.h>
15#include <linux/mutex.h> 16#include <linux/mutex.h>
16#include <linux/device.h> 17#include <linux/device.h>
@@ -62,7 +63,7 @@ struct gameport_driver {
62 63
63 struct device_driver driver; 64 struct device_driver driver;
64 65
65 unsigned int ignore; 66 bool ignore;
66}; 67};
67#define to_gameport_driver(d) container_of(d, struct gameport_driver, driver) 68#define to_gameport_driver(d) container_of(d, struct gameport_driver, driver)
68 69
diff --git a/include/linux/serio.h b/include/linux/serio.h
index e0417e4d3f15..126d24c9eaa8 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -15,6 +15,7 @@
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18#include <linux/types.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/list.h> 20#include <linux/list.h>
20#include <linux/spinlock.h> 21#include <linux/spinlock.h>
@@ -28,7 +29,10 @@ struct serio {
28 char name[32]; 29 char name[32];
29 char phys[32]; 30 char phys[32];
30 31
31 unsigned int manual_bind; 32 bool manual_bind;
33 bool registered; /* port has been fully registered with driver core */
34 bool suspended; /* port is suspended */
35
32 36
33 struct serio_device_id id; 37 struct serio_device_id id;
34 38
@@ -47,7 +51,6 @@ struct serio {
47 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ 51 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */
48 52
49 struct device dev; 53 struct device dev;
50 unsigned int registered; /* port has been fully registered with driver core */
51 54
52 struct list_head node; 55 struct list_head node;
53}; 56};
@@ -58,7 +61,7 @@ struct serio_driver {
58 char *description; 61 char *description;
59 62
60 struct serio_device_id *id_table; 63 struct serio_device_id *id_table;
61 unsigned int manual_bind; 64 bool manual_bind;
62 65
63 void (*write_wakeup)(struct serio *); 66 void (*write_wakeup)(struct serio *);
64 irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int); 67 irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int);