common.c (4295733eee4e69eda432d95765b7762dc6013271) common.c (989561de9b5112999475b406557d9c7e9e59c041)
1/*
2 * drivers/base/power/common.c - Common device power management code.
3 *
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
5 *
6 * This file is released under the GPLv2.
7 */
8

--- 114 unchanged lines hidden (view full) ---

123 * management callbacks.
124 */
125void dev_pm_domain_detach(struct device *dev, bool power_off)
126{
127 if (dev->pm_domain && dev->pm_domain->detach)
128 dev->pm_domain->detach(dev, power_off);
129}
130EXPORT_SYMBOL_GPL(dev_pm_domain_detach);
1/*
2 * drivers/base/power/common.c - Common device power management code.
3 *
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
5 *
6 * This file is released under the GPLv2.
7 */
8

--- 114 unchanged lines hidden (view full) ---

123 * management callbacks.
124 */
125void dev_pm_domain_detach(struct device *dev, bool power_off)
126{
127 if (dev->pm_domain && dev->pm_domain->detach)
128 dev->pm_domain->detach(dev, power_off);
129}
130EXPORT_SYMBOL_GPL(dev_pm_domain_detach);
131
132/**
133 * dev_pm_domain_set - Set PM domain of a device.
134 * @dev: Device whose PM domain is to be set.
135 * @pd: PM domain to be set, or NULL.
136 *
137 * Sets the PM domain the device belongs to. The PM domain of a device needs
138 * to be set before its probe finishes (it's bound to a driver).
139 *
140 * This function must be called with the device lock held.
141 */
142void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd)
143{
144 if (dev->pm_domain == pd)
145 return;
146
147 WARN(device_is_bound(dev),
148 "PM domains can only be changed for unbound devices\n");
149 dev->pm_domain = pd;
150}
151EXPORT_SYMBOL_GPL(dev_pm_domain_set);