Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: serio - do not use deprecated dev.power.power_state

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

+39 -33
+3 -3
drivers/input/gameport/gameport.c
··· 723 723 * Temporarily disable automatic binding because probing 724 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 728 error = driver_register(&drv->driver); 729 729 if (error) { ··· 736 736 /* 737 737 * Reset ignore flag and let kgameportd bind the driver to free ports 738 738 */ 739 - drv->ignore = 0; 739 + drv->ignore = false; 740 740 error = gameport_queue_event(drv, NULL, GAMEPORT_ATTACH_DRIVER); 741 741 if (error) { 742 742 driver_unregister(&drv->driver); ··· 753 753 754 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 757 gameport_remove_pending_events(drv); 758 758 759 759 start_over:
+9 -8
drivers/input/serio/i8042.c
··· 10 10 * the Free Software Foundation. 11 11 */ 12 12 13 + #include <linux/types.h> 13 14 #include <linux/delay.h> 14 15 #include <linux/module.h> 15 16 #include <linux/interrupt.h> ··· 922 921 #endif 923 922 924 923 #ifdef CONFIG_PM 924 + 925 + static bool i8042_suspended; 926 + 925 927 /* 926 928 * Here we try to restore the original BIOS settings. We only want to 927 929 * do that once, when we really suspend, not when we taking memory ··· 934 930 935 931 static int i8042_suspend(struct platform_device *dev, pm_message_t state) 936 932 { 937 - if (dev->dev.power.power_state.event != state.event) { 938 - if (state.event == PM_EVENT_SUSPEND) 939 - i8042_controller_reset(); 940 - 941 - dev->dev.power.power_state = state; 933 + if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) { 934 + i8042_controller_reset(); 935 + i8042_suspended = true; 942 936 } 943 937 944 938 return 0; ··· 954 952 /* 955 953 * Do not bother with restoring state if we haven't suspened yet 956 954 */ 957 - if (dev->dev.power.power_state.event == PM_EVENT_ON) 955 + if (!i8042_suspended) 958 956 return 0; 959 957 960 958 error = i8042_controller_check(); ··· 1000 998 if (i8042_ports[I8042_KBD_PORT_NO].serio) 1001 999 i8042_enable_kbd_port(); 1002 1000 1001 + i8042_suspended = false; 1003 1002 i8042_interrupt(0, NULL); 1004 - 1005 - dev->dev.power.power_state = PMSG_ON; 1006 1003 1007 1004 return 0; 1008 1005 }
+19 -18
drivers/input/serio/serio.c
··· 495 495 496 496 retval = count; 497 497 if (!strncmp(buf, "manual", count)) { 498 - serio->manual_bind = 1; 498 + serio->manual_bind = true; 499 499 } else if (!strncmp(buf, "auto", count)) { 500 - serio->manual_bind = 0; 500 + serio->manual_bind = false; 501 501 } else { 502 502 retval = -EINVAL; 503 503 } ··· 570 570 "serio: device_add() failed for %s (%s), error: %d\n", 571 571 serio->phys, serio->name, error); 572 572 else { 573 - serio->registered = 1; 573 + serio->registered = true; 574 574 error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); 575 575 if (error) 576 576 printk(KERN_ERR ··· 606 606 if (serio->registered) { 607 607 sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); 608 608 device_del(&serio->dev); 609 - serio->registered = 0; 609 + serio->registered = false; 610 610 } 611 611 612 612 list_del_init(&serio->node); ··· 750 750 751 751 retval = count; 752 752 if (!strncmp(buf, "manual", count)) { 753 - serio_drv->manual_bind = 1; 753 + serio_drv->manual_bind = true; 754 754 } else if (!strncmp(buf, "auto", count)) { 755 - serio_drv->manual_bind = 0; 755 + serio_drv->manual_bind = false; 756 756 } else { 757 757 retval = -EINVAL; 758 758 } ··· 812 812 813 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 816 int error; 817 817 818 818 drv->driver.bus = &serio_bus; ··· 823 823 * Temporarily disable automatic binding because probing 824 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 828 error = driver_register(&drv->driver); 829 829 if (error) { ··· 838 838 * driver to free ports 839 839 */ 840 840 if (!manual_bind) { 841 - drv->manual_bind = 0; 841 + drv->manual_bind = false; 842 842 error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER); 843 843 if (error) { 844 844 driver_unregister(&drv->driver); ··· 856 856 857 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 860 serio_remove_pending_events(drv); 861 861 862 862 start_over: ··· 933 933 #ifdef CONFIG_PM 934 934 static int serio_suspend(struct device *dev, pm_message_t state) 935 935 { 936 - if (dev->power.power_state.event != state.event) { 937 - if (state.event == PM_EVENT_SUSPEND) 938 - serio_cleanup(to_serio_port(dev)); 936 + struct serio *serio = 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 943 return 0; ··· 945 945 946 946 static int serio_resume(struct device *dev) 947 947 { 948 + struct serio *serio = to_serio_port(dev); 949 + 948 950 /* 949 951 * Driver reconnect can take a while, so better let kseriod 950 952 * deal with it. 951 953 */ 952 - if (dev->power.power_state.event != PM_EVENT_ON) { 953 - dev->power.power_state = PMSG_ON; 954 - serio_queue_event(to_serio_port(dev), NULL, 955 - SERIO_RECONNECT_PORT); 954 + if (serio->suspended) { 955 + serio->suspended = false; 956 + serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT); 956 957 } 957 958 958 959 return 0;
+2 -1
include/linux/gameport.h
··· 11 11 12 12 #ifdef __KERNEL__ 13 13 #include <asm/io.h> 14 + #include <linux/types.h> 14 15 #include <linux/list.h> 15 16 #include <linux/mutex.h> 16 17 #include <linux/device.h> ··· 63 62 64 63 struct device_driver driver; 65 64 66 - unsigned int ignore; 65 + bool ignore; 67 66 }; 68 67 #define to_gameport_driver(d) container_of(d, struct gameport_driver, driver) 69 68
+6 -3
include/linux/serio.h
··· 15 15 16 16 #ifdef __KERNEL__ 17 17 18 + #include <linux/types.h> 18 19 #include <linux/interrupt.h> 19 20 #include <linux/list.h> 20 21 #include <linux/spinlock.h> ··· 29 28 char name[32]; 30 29 char phys[32]; 31 30 32 - unsigned int manual_bind; 31 + bool manual_bind; 32 + bool registered; /* port has been fully registered with driver core */ 33 + bool suspended; /* port is suspended */ 34 + 33 35 34 36 struct serio_device_id id; 35 37 ··· 51 47 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ 52 48 53 49 struct device dev; 54 - unsigned int registered; /* port has been fully registered with driver core */ 55 50 56 51 struct list_head node; 57 52 }; ··· 61 58 char *description; 62 59 63 60 struct serio_device_id *id_table; 64 - unsigned int manual_bind; 61 + bool manual_bind; 65 62 66 63 void (*write_wakeup)(struct serio *); 67 64 irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int);