diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-08-07 13:06:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-08-21 13:15:36 -0400 |
commit | 3b98aeaf3a75f544dc945694f4fcf6e1c4bab89d (patch) | |
tree | bebaa8c3353ba9e7d5142dc73c767dc030bca7e3 /drivers/base/power/main.c | |
parent | 7c2250352e11bf956c4cfa20b01ae6ba72882788 (diff) |
PM: don't skip device PM init when CONFIG_PM_SLEEP isn't set and CONFIG_PM is set
This patch (as1124) fixes a couple of bugs in the PM core. The new
dev->power.status field should be initialized regardless of whether
CONFIG_PM_SLEEP is enabled, and similarly dpm_sysfs_add() should be
called whenever CONFIG_PM is enabled.
The patch separates out the call to dpm_sysfs_add() from the call to
device_pm_add(). As a result device_pm_add() can no longer return an
error, so its return type is changed to void.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Romit Dasgupta <romit@ti.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/power/main.c')
-rw-r--r-- | drivers/base/power/main.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 3250c5257b74..284f564bb12b 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -67,10 +67,8 @@ void device_pm_unlock(void) | |||
67 | * device_pm_add - add a device to the list of active devices | 67 | * device_pm_add - add a device to the list of active devices |
68 | * @dev: Device to be added to the list | 68 | * @dev: Device to be added to the list |
69 | */ | 69 | */ |
70 | int device_pm_add(struct device *dev) | 70 | void device_pm_add(struct device *dev) |
71 | { | 71 | { |
72 | int error; | ||
73 | |||
74 | pr_debug("PM: Adding info for %s:%s\n", | 72 | pr_debug("PM: Adding info for %s:%s\n", |
75 | dev->bus ? dev->bus->name : "No Bus", | 73 | dev->bus ? dev->bus->name : "No Bus", |
76 | kobject_name(&dev->kobj)); | 74 | kobject_name(&dev->kobj)); |
@@ -89,13 +87,9 @@ int device_pm_add(struct device *dev) | |||
89 | */ | 87 | */ |
90 | WARN_ON(true); | 88 | WARN_ON(true); |
91 | } | 89 | } |
92 | error = dpm_sysfs_add(dev); | 90 | |
93 | if (!error) { | 91 | list_add_tail(&dev->power.entry, &dpm_list); |
94 | dev->power.status = DPM_ON; | ||
95 | list_add_tail(&dev->power.entry, &dpm_list); | ||
96 | } | ||
97 | mutex_unlock(&dpm_list_mtx); | 92 | mutex_unlock(&dpm_list_mtx); |
98 | return error; | ||
99 | } | 93 | } |
100 | 94 | ||
101 | /** | 95 | /** |
@@ -110,7 +104,6 @@ void device_pm_remove(struct device *dev) | |||
110 | dev->bus ? dev->bus->name : "No Bus", | 104 | dev->bus ? dev->bus->name : "No Bus", |
111 | kobject_name(&dev->kobj)); | 105 | kobject_name(&dev->kobj)); |
112 | mutex_lock(&dpm_list_mtx); | 106 | mutex_lock(&dpm_list_mtx); |
113 | dpm_sysfs_remove(dev); | ||
114 | list_del_init(&dev->power.entry); | 107 | list_del_init(&dev->power.entry); |
115 | mutex_unlock(&dpm_list_mtx); | 108 | mutex_unlock(&dpm_list_mtx); |
116 | } | 109 | } |