Commit 7e044e05 authored by Dmitry Torokhov's avatar Dmitry Torokhov

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

Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 6f660f12
...@@ -723,7 +723,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner ...@@ -723,7 +723,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner
* Temporarily disable automatic binding because probing * Temporarily disable automatic binding because probing
* takes long time and we are better off doing it in kgameportd * takes long time and we are better off doing it in kgameportd
*/ */
drv->ignore = 1; drv->ignore = true;
error = driver_register(&drv->driver); error = driver_register(&drv->driver);
if (error) { if (error) {
...@@ -736,7 +736,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner ...@@ -736,7 +736,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner
/* /*
* Reset ignore flag and let kgameportd bind the driver to free ports * Reset ignore flag and let kgameportd bind the driver to free ports
*/ */
drv->ignore = 0; drv->ignore = false;
error = gameport_queue_event(drv, NULL, GAMEPORT_ATTACH_DRIVER); error = gameport_queue_event(drv, NULL, GAMEPORT_ATTACH_DRIVER);
if (error) { if (error) {
driver_unregister(&drv->driver); driver_unregister(&drv->driver);
...@@ -753,7 +753,7 @@ void gameport_unregister_driver(struct gameport_driver *drv) ...@@ -753,7 +753,7 @@ void gameport_unregister_driver(struct gameport_driver *drv)
mutex_lock(&gameport_mutex); mutex_lock(&gameport_mutex);
drv->ignore = 1; /* so gameport_find_driver ignores it */ drv->ignore = true; /* so gameport_find_driver ignores it */
gameport_remove_pending_events(drv); gameport_remove_pending_events(drv);
start_over: start_over:
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* the Free Software Foundation. * the Free Software Foundation.
*/ */
#include <linux/types.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -921,6 +922,9 @@ static void i8042_dritek_enable(void) ...@@ -921,6 +922,9 @@ static void i8042_dritek_enable(void)
#endif #endif
#ifdef CONFIG_PM #ifdef CONFIG_PM
static bool i8042_suspended;
/* /*
* Here we try to restore the original BIOS settings. We only want to * Here we try to restore the original BIOS settings. We only want to
* do that once, when we really suspend, not when we taking memory * do that once, when we really suspend, not when we taking memory
...@@ -930,11 +934,9 @@ static void i8042_dritek_enable(void) ...@@ -930,11 +934,9 @@ static void i8042_dritek_enable(void)
static int i8042_suspend(struct platform_device *dev, pm_message_t state) static int i8042_suspend(struct platform_device *dev, pm_message_t state)
{ {
if (dev->dev.power.power_state.event != state.event) { if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) {
if (state.event == PM_EVENT_SUSPEND) i8042_controller_reset();
i8042_controller_reset(); i8042_suspended = true;
dev->dev.power.power_state = state;
} }
return 0; return 0;
...@@ -952,7 +954,7 @@ static int i8042_resume(struct platform_device *dev) ...@@ -952,7 +954,7 @@ static int i8042_resume(struct platform_device *dev)
/* /*
* Do not bother with restoring state if we haven't suspened yet * Do not bother with restoring state if we haven't suspened yet
*/ */
if (dev->dev.power.power_state.event == PM_EVENT_ON) if (!i8042_suspended)
return 0; return 0;
error = i8042_controller_check(); error = i8042_controller_check();
...@@ -998,10 +1000,9 @@ static int i8042_resume(struct platform_device *dev) ...@@ -998,10 +1000,9 @@ static int i8042_resume(struct platform_device *dev)
if (i8042_ports[I8042_KBD_PORT_NO].serio) if (i8042_ports[I8042_KBD_PORT_NO].serio)
i8042_enable_kbd_port(); i8042_enable_kbd_port();
i8042_suspended = false;
i8042_interrupt(0, NULL); i8042_interrupt(0, NULL);
dev->dev.power.power_state = PMSG_ON;
return 0; return 0;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
......
...@@ -495,9 +495,9 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute * ...@@ -495,9 +495,9 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
retval = count; retval = count;
if (!strncmp(buf, "manual", count)) { if (!strncmp(buf, "manual", count)) {
serio->manual_bind = 1; serio->manual_bind = true;
} else if (!strncmp(buf, "auto", count)) { } else if (!strncmp(buf, "auto", count)) {
serio->manual_bind = 0; serio->manual_bind = false;
} else { } else {
retval = -EINVAL; retval = -EINVAL;
} }
...@@ -570,7 +570,7 @@ static void serio_add_port(struct serio *serio) ...@@ -570,7 +570,7 @@ static void serio_add_port(struct serio *serio)
"serio: device_add() failed for %s (%s), error: %d\n", "serio: device_add() failed for %s (%s), error: %d\n",
serio->phys, serio->name, error); serio->phys, serio->name, error);
else { else {
serio->registered = 1; serio->registered = true;
error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
if (error) if (error)
printk(KERN_ERR printk(KERN_ERR
...@@ -606,7 +606,7 @@ static void serio_destroy_port(struct serio *serio) ...@@ -606,7 +606,7 @@ static void serio_destroy_port(struct serio *serio)
if (serio->registered) { if (serio->registered) {
sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
device_del(&serio->dev); device_del(&serio->dev);
serio->registered = 0; serio->registered = false;
} }
list_del_init(&serio->node); list_del_init(&serio->node);
...@@ -750,9 +750,9 @@ static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char ...@@ -750,9 +750,9 @@ static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char
retval = count; retval = count;
if (!strncmp(buf, "manual", count)) { if (!strncmp(buf, "manual", count)) {
serio_drv->manual_bind = 1; serio_drv->manual_bind = true;
} else if (!strncmp(buf, "auto", count)) { } else if (!strncmp(buf, "auto", count)) {
serio_drv->manual_bind = 0; serio_drv->manual_bind = false;
} else { } else {
retval = -EINVAL; retval = -EINVAL;
} }
...@@ -812,7 +812,7 @@ static void serio_attach_driver(struct serio_driver *drv) ...@@ -812,7 +812,7 @@ static void serio_attach_driver(struct serio_driver *drv)
int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name)
{ {
int manual_bind = drv->manual_bind; bool manual_bind = drv->manual_bind;
int error; int error;
drv->driver.bus = &serio_bus; drv->driver.bus = &serio_bus;
...@@ -823,7 +823,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons ...@@ -823,7 +823,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
* Temporarily disable automatic binding because probing * Temporarily disable automatic binding because probing
* takes long time and we are better off doing it in kseriod * takes long time and we are better off doing it in kseriod
*/ */
drv->manual_bind = 1; drv->manual_bind = true;
error = driver_register(&drv->driver); error = driver_register(&drv->driver);
if (error) { if (error) {
...@@ -838,7 +838,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons ...@@ -838,7 +838,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
* driver to free ports * driver to free ports
*/ */
if (!manual_bind) { if (!manual_bind) {
drv->manual_bind = 0; drv->manual_bind = false;
error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER); error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER);
if (error) { if (error) {
driver_unregister(&drv->driver); driver_unregister(&drv->driver);
...@@ -856,7 +856,7 @@ void serio_unregister_driver(struct serio_driver *drv) ...@@ -856,7 +856,7 @@ void serio_unregister_driver(struct serio_driver *drv)
mutex_lock(&serio_mutex); mutex_lock(&serio_mutex);
drv->manual_bind = 1; /* so serio_find_driver ignores it */ drv->manual_bind = true; /* so serio_find_driver ignores it */
serio_remove_pending_events(drv); serio_remove_pending_events(drv);
start_over: start_over:
...@@ -933,11 +933,11 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -933,11 +933,11 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int serio_suspend(struct device *dev, pm_message_t state) static int serio_suspend(struct device *dev, pm_message_t state)
{ {
if (dev->power.power_state.event != state.event) { struct serio *serio = to_serio_port(dev);
if (state.event == PM_EVENT_SUSPEND)
serio_cleanup(to_serio_port(dev));
dev->power.power_state = state; if (!serio->suspended && state.event == PM_EVENT_SUSPEND) {
serio_cleanup(serio);
serio->suspended = true;
} }
return 0; return 0;
...@@ -945,14 +945,15 @@ static int serio_suspend(struct device *dev, pm_message_t state) ...@@ -945,14 +945,15 @@ static int serio_suspend(struct device *dev, pm_message_t state)
static int serio_resume(struct device *dev) static int serio_resume(struct device *dev)
{ {
struct serio *serio = to_serio_port(dev);
/* /*
* Driver reconnect can take a while, so better let kseriod * Driver reconnect can take a while, so better let kseriod
* deal with it. * deal with it.
*/ */
if (dev->power.power_state.event != PM_EVENT_ON) { if (serio->suspended) {
dev->power.power_state = PMSG_ON; serio->suspended = false;
serio_queue_event(to_serio_port(dev), NULL, serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
SERIO_RECONNECT_PORT);
} }
return 0; return 0;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <asm/io.h> #include <asm/io.h>
#include <linux/types.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -62,7 +63,7 @@ struct gameport_driver { ...@@ -62,7 +63,7 @@ struct gameport_driver {
struct device_driver driver; struct device_driver driver;
unsigned int ignore; bool ignore;
}; };
#define to_gameport_driver(d) container_of(d, struct gameport_driver, driver) #define to_gameport_driver(d) container_of(d, struct gameport_driver, driver)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/types.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -28,7 +29,10 @@ struct serio { ...@@ -28,7 +29,10 @@ struct serio {
char name[32]; char name[32];
char phys[32]; char phys[32];
unsigned int manual_bind; bool manual_bind;
bool registered; /* port has been fully registered with driver core */
bool suspended; /* port is suspended */
struct serio_device_id id; struct serio_device_id id;
...@@ -47,7 +51,6 @@ struct serio { ...@@ -47,7 +51,6 @@ struct serio {
struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */
struct device dev; struct device dev;
unsigned int registered; /* port has been fully registered with driver core */
struct list_head node; struct list_head node;
}; };
...@@ -58,7 +61,7 @@ struct serio_driver { ...@@ -58,7 +61,7 @@ struct serio_driver {
char *description; char *description;
struct serio_device_id *id_table; struct serio_device_id *id_table;
unsigned int manual_bind; bool manual_bind;
void (*write_wakeup)(struct serio *); void (*write_wakeup)(struct serio *);
irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int); irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment