Skip to content

Commit

Permalink
Input: serio - switch to using dev_pm_ops
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Dmitry Torokhov committed Jul 26, 2009
1 parent ebd7768 commit 633aae2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
23 changes: 11 additions & 12 deletions drivers/input/serio/serio.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,15 +931,11 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
#endif /* CONFIG_HOTPLUG */

#ifdef CONFIG_PM
static int serio_suspend(struct device *dev, pm_message_t state)
static int serio_suspend(struct device *dev)
{
struct serio *serio = to_serio_port(dev);

if (!serio->suspended && state.event == PM_EVENT_SUSPEND)
serio_cleanup(serio);

serio->suspended = state.event == PM_EVENT_SUSPEND ||
state.event == PM_EVENT_FREEZE;
serio_cleanup(serio);

return 0;
}
Expand All @@ -952,13 +948,17 @@ static int serio_resume(struct device *dev)
* Driver reconnect can take a while, so better let kseriod
* deal with it.
*/
if (serio->suspended) {
serio->suspended = false;
serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
}
serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);

return 0;
}

static const struct dev_pm_ops serio_pm_ops = {
.suspend = serio_suspend,
.resume = serio_resume,
.poweroff = serio_suspend,
.restore = serio_resume,
};
#endif /* CONFIG_PM */

/* called from serio_driver->connect/disconnect methods under serio_mutex */
Expand Down Expand Up @@ -1015,8 +1015,7 @@ static struct bus_type serio_bus = {
.remove = serio_driver_remove,
.shutdown = serio_shutdown,
#ifdef CONFIG_PM
.suspend = serio_suspend,
.resume = serio_resume,
.pm = &serio_pm_ops,
#endif
};

Expand Down
2 changes: 0 additions & 2 deletions include/linux/serio.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ struct serio {

bool manual_bind;
bool registered; /* port has been fully registered with driver core */
bool suspended; /* port is suspended */


struct serio_device_id id;

Expand Down

0 comments on commit 633aae2

Please sign in to comment.