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
* Temporarily disable automatic binding because probing
* takes long time and we are better off doing it in kgameportd
*/
drv->ignore = 1;
drv->ignore = true;
error = driver_register(&drv->driver);
if (error) {
......@@ -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
*/
drv->ignore = 0;
drv->ignore = false;
error = gameport_queue_event(drv, NULL, GAMEPORT_ATTACH_DRIVER);
if (error) {
driver_unregister(&drv->driver);
......@@ -753,7 +753,7 @@ void gameport_unregister_driver(struct gameport_driver *drv)
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);
start_over:
......
......@@ -10,6 +10,7 @@
* the Free Software Foundation.
*/
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/interrupt.h>
......@@ -921,6 +922,9 @@ static void i8042_dritek_enable(void)
#endif
#ifdef CONFIG_PM
static bool i8042_suspended;
/*
* 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
......@@ -930,11 +934,9 @@ static void i8042_dritek_enable(void)
static int i8042_suspend(struct platform_device *dev, pm_message_t state)
{
if (dev->dev.power.power_state.event != state.event) {
if (state.event == PM_EVENT_SUSPEND)
i8042_controller_reset();
dev->dev.power.power_state = state;
if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) {
i8042_controller_reset();
i8042_suspended = true;
}
return 0;
......@@ -952,7 +954,7 @@ static int i8042_resume(struct platform_device *dev)
/*
* 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;
error = i8042_controller_check();
......@@ -998,10 +1000,9 @@ static int i8042_resume(struct platform_device *dev)
if (i8042_ports[I8042_KBD_PORT_NO].serio)
i8042_enable_kbd_port();
i8042_suspended = false;
i8042_interrupt(0, NULL);
dev->dev.power.power_state = PMSG_ON;
return 0;
}
#endif /* CONFIG_PM */
......
......@@ -495,9 +495,9 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
retval = count;
if (!strncmp(buf, "manual", count)) {
serio->manual_bind = 1;
serio->manual_bind = true;
} else if (!strncmp(buf, "auto", count)) {
serio->manual_bind = 0;
serio->manual_bind = false;
} else {
retval = -EINVAL;
}
......@@ -570,7 +570,7 @@ static void serio_add_port(struct serio *serio)
"serio: device_add() failed for %s (%s), error: %d\n",
serio->phys, serio->name, error);
else {
serio->registered = 1;
serio->registered = true;
error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
if (error)
printk(KERN_ERR
......@@ -606,7 +606,7 @@ static void serio_destroy_port(struct serio *serio)
if (serio->registered) {
sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
device_del(&serio->dev);
serio->registered = 0;
serio->registered = false;
}
list_del_init(&serio->node);
......@@ -750,9 +750,9 @@ static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char
retval = count;
if (!strncmp(buf, "manual", count)) {
serio_drv->manual_bind = 1;
serio_drv->manual_bind = true;
} else if (!strncmp(buf, "auto", count)) {
serio_drv->manual_bind = 0;
serio_drv->manual_bind = false;
} else {
retval = -EINVAL;
}
......@@ -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 manual_bind = drv->manual_bind;
bool manual_bind = drv->manual_bind;
int error;
drv->driver.bus = &serio_bus;
......@@ -823,7 +823,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
* Temporarily disable automatic binding because probing
* 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);
if (error) {
......@@ -838,7 +838,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
* driver to free ports
*/
if (!manual_bind) {
drv->manual_bind = 0;
drv->manual_bind = false;
error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER);
if (error) {
driver_unregister(&drv->driver);
......@@ -856,7 +856,7 @@ void serio_unregister_driver(struct serio_driver *drv)
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);
start_over:
......@@ -933,11 +933,11 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
#ifdef CONFIG_PM
static int serio_suspend(struct device *dev, pm_message_t state)
{
if (dev->power.power_state.event != state.event) {
if (state.event == PM_EVENT_SUSPEND)
serio_cleanup(to_serio_port(dev));
struct serio *serio = 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;
......@@ -945,14 +945,15 @@ static int serio_suspend(struct device *dev, pm_message_t state)
static int serio_resume(struct device *dev)
{
struct serio *serio = to_serio_port(dev);
/*
* Driver reconnect can take a while, so better let kseriod
* deal with it.
*/
if (dev->power.power_state.event != PM_EVENT_ON) {
dev->power.power_state = PMSG_ON;
serio_queue_event(to_serio_port(dev), NULL,
SERIO_RECONNECT_PORT);
if (serio->suspended) {
serio->suspended = false;
serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
}
return 0;
......
......@@ -11,6 +11,7 @@
#ifdef __KERNEL__
#include <asm/io.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/device.h>
......@@ -62,7 +63,7 @@ struct gameport_driver {
struct device_driver driver;
unsigned int ignore;
bool ignore;
};
#define to_gameport_driver(d) container_of(d, struct gameport_driver, driver)
......
......@@ -15,6 +15,7 @@
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/spinlock.h>
......@@ -28,7 +29,10 @@ struct serio {
char name[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;
......@@ -47,7 +51,6 @@ struct serio {
struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */
struct device dev;
unsigned int registered; /* port has been fully registered with driver core */
struct list_head node;
};
......@@ -58,7 +61,7 @@ struct serio_driver {
char *description;
struct serio_device_id *id_table;
unsigned int manual_bind;
bool manual_bind;
void (*write_wakeup)(struct serio *);
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