diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/main.c | 26 | ||||
-rw-r--r-- | drivers/base/power/power.h | 13 | ||||
-rw-r--r-- | drivers/base/power/runtime.c | 1 |
3 files changed, 4 insertions, 36 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 15e6a8f951f1..0d2e101e4f15 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -30,23 +30,6 @@ LIST_HEAD(dpm_off_irq); | |||
30 | DECLARE_MUTEX(dpm_sem); | 30 | DECLARE_MUTEX(dpm_sem); |
31 | DECLARE_MUTEX(dpm_list_sem); | 31 | DECLARE_MUTEX(dpm_list_sem); |
32 | 32 | ||
33 | /* | ||
34 | * PM Reference Counting. | ||
35 | */ | ||
36 | |||
37 | static inline void device_pm_hold(struct device * dev) | ||
38 | { | ||
39 | if (dev) | ||
40 | atomic_inc(&dev->power.pm_users); | ||
41 | } | ||
42 | |||
43 | static inline void device_pm_release(struct device * dev) | ||
44 | { | ||
45 | if (dev) | ||
46 | atomic_dec(&dev->power.pm_users); | ||
47 | } | ||
48 | |||
49 | |||
50 | /** | 33 | /** |
51 | * device_pm_set_parent - Specify power dependency. | 34 | * device_pm_set_parent - Specify power dependency. |
52 | * @dev: Device who needs power. | 35 | * @dev: Device who needs power. |
@@ -62,10 +45,8 @@ static inline void device_pm_release(struct device * dev) | |||
62 | 45 | ||
63 | void device_pm_set_parent(struct device * dev, struct device * parent) | 46 | void device_pm_set_parent(struct device * dev, struct device * parent) |
64 | { | 47 | { |
65 | struct device * old_parent = dev->power.pm_parent; | 48 | put_device(dev->power.pm_parent); |
66 | device_pm_release(old_parent); | 49 | dev->power.pm_parent = get_device(parent); |
67 | dev->power.pm_parent = parent; | ||
68 | device_pm_hold(parent); | ||
69 | } | 50 | } |
70 | EXPORT_SYMBOL_GPL(device_pm_set_parent); | 51 | EXPORT_SYMBOL_GPL(device_pm_set_parent); |
71 | 52 | ||
@@ -75,7 +56,6 @@ int device_pm_add(struct device * dev) | |||
75 | 56 | ||
76 | pr_debug("PM: Adding info for %s:%s\n", | 57 | pr_debug("PM: Adding info for %s:%s\n", |
77 | dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); | 58 | dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); |
78 | atomic_set(&dev->power.pm_users, 0); | ||
79 | down(&dpm_list_sem); | 59 | down(&dpm_list_sem); |
80 | list_add_tail(&dev->power.entry, &dpm_active); | 60 | list_add_tail(&dev->power.entry, &dpm_active); |
81 | device_pm_set_parent(dev, dev->parent); | 61 | device_pm_set_parent(dev, dev->parent); |
@@ -91,7 +71,7 @@ void device_pm_remove(struct device * dev) | |||
91 | dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); | 71 | dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); |
92 | down(&dpm_list_sem); | 72 | down(&dpm_list_sem); |
93 | dpm_sysfs_remove(dev); | 73 | dpm_sysfs_remove(dev); |
94 | device_pm_release(dev->power.pm_parent); | 74 | put_device(dev->power.pm_parent); |
95 | list_del_init(&dev->power.entry); | 75 | list_del_init(&dev->power.entry); |
96 | up(&dpm_list_sem); | 76 | up(&dpm_list_sem); |
97 | } | 77 | } |
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index 2e700d795cf1..fb3d35a9e101 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
@@ -67,9 +67,6 @@ extern int suspend_device(struct device *, pm_message_t); | |||
67 | * runtime.c | 67 | * runtime.c |
68 | */ | 68 | */ |
69 | 69 | ||
70 | extern int dpm_runtime_suspend(struct device *, pm_message_t); | ||
71 | extern void dpm_runtime_resume(struct device *); | ||
72 | |||
73 | #else /* CONFIG_PM */ | 70 | #else /* CONFIG_PM */ |
74 | 71 | ||
75 | 72 | ||
@@ -82,14 +79,4 @@ static inline void device_pm_remove(struct device * dev) | |||
82 | 79 | ||
83 | } | 80 | } |
84 | 81 | ||
85 | static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state) | ||
86 | { | ||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static inline void dpm_runtime_resume(struct device * dev) | ||
91 | { | ||
92 | |||
93 | } | ||
94 | |||
95 | #endif | 82 | #endif |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index e8f0519f5dfa..adbc3148c039 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -36,6 +36,7 @@ void dpm_runtime_resume(struct device * dev) | |||
36 | runtime_resume(dev); | 36 | runtime_resume(dev); |
37 | up(&dpm_sem); | 37 | up(&dpm_sem); |
38 | } | 38 | } |
39 | EXPORT_SYMBOL(dpm_runtime_resume); | ||
39 | 40 | ||
40 | 41 | ||
41 | /** | 42 | /** |