aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/main.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-06-13 09:53:34 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:09:01 -0400
commit9cddad77574313fcee36c5e60122718daa7c0361 (patch)
tree2d6dd05e02ffff565ffb23046933f33cda0531e8 /drivers/base/power/main.c
parent11048dcf333c414f237bb713c422e68f67b115a3 (diff)
PM: Remove pm_parent from struct dev_pm_info
The pm_parent member of struct dev_pm_info (defined in include/linux/pm.h) is only used to check if the device's parent is in the right state while the device is being suspended or resumed. However, this can be done just as well with the help of the parent pointer in struct device, so pm_parent can be removed along with some code that handles it. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/power/main.c')
-rw-r--r--drivers/base/power/main.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 7b3cc3c15b9d..eb9f38d0aa58 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -33,28 +33,7 @@ DEFINE_MUTEX(dpm_list_mtx);
33 33
34int (*platform_enable_wakeup)(struct device *dev, int is_on); 34int (*platform_enable_wakeup)(struct device *dev, int is_on);
35 35
36 36int device_pm_add(struct device *dev)
37/**
38 * device_pm_set_parent - Specify power dependency.
39 * @dev: Device who needs power.
40 * @parent: Device that supplies power.
41 *
42 * This function is used to manually describe a power-dependency
43 * relationship. It may be used to specify a transversal relationship
44 * (where the power supplier is not the physical (or electrical)
45 * ancestor of a specific device.
46 * The effect of this is that the supplier will not be powered down
47 * before the power dependent.
48 */
49
50void device_pm_set_parent(struct device * dev, struct device * parent)
51{
52 put_device(dev->power.pm_parent);
53 dev->power.pm_parent = get_device(parent);
54}
55EXPORT_SYMBOL_GPL(device_pm_set_parent);
56
57int device_pm_add(struct device * dev)
58{ 37{
59 int error; 38 int error;
60 39
@@ -63,21 +42,20 @@ int device_pm_add(struct device * dev)
63 kobject_name(&dev->kobj)); 42 kobject_name(&dev->kobj));
64 mutex_lock(&dpm_list_mtx); 43 mutex_lock(&dpm_list_mtx);
65 list_add_tail(&dev->power.entry, &dpm_active); 44 list_add_tail(&dev->power.entry, &dpm_active);
66 device_pm_set_parent(dev, dev->parent); 45 error = dpm_sysfs_add(dev);
67 if ((error = dpm_sysfs_add(dev))) 46 if (error)
68 list_del(&dev->power.entry); 47 list_del(&dev->power.entry);
69 mutex_unlock(&dpm_list_mtx); 48 mutex_unlock(&dpm_list_mtx);
70 return error; 49 return error;
71} 50}
72 51
73void device_pm_remove(struct device * dev) 52void device_pm_remove(struct device *dev)
74{ 53{
75 pr_debug("PM: Removing info for %s:%s\n", 54 pr_debug("PM: Removing info for %s:%s\n",
76 dev->bus ? dev->bus->name : "No Bus", 55 dev->bus ? dev->bus->name : "No Bus",
77 kobject_name(&dev->kobj)); 56 kobject_name(&dev->kobj));
78 mutex_lock(&dpm_list_mtx); 57 mutex_lock(&dpm_list_mtx);
79 dpm_sysfs_remove(dev); 58 dpm_sysfs_remove(dev);
80 put_device(dev->power.pm_parent);
81 list_del_init(&dev->power.entry); 59 list_del_init(&dev->power.entry);
82 mutex_unlock(&dpm_list_mtx); 60 mutex_unlock(&dpm_list_mtx);
83} 61}