diff options
Diffstat (limited to 'drivers/input/serio/serio.c')
-rw-r--r-- | drivers/input/serio/serio.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 8d2df5d..fb17573 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 * 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; |