summaryrefslogtreecommitdiff
path: root/drivers/base/power/common.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-08-05 23:46:39 (GMT)
committerRafael J. Wysocki <rjw@sisk.pl>2012-09-03 23:36:04 (GMT)
commitdbf374142dd7a3c394ec124ebe7339a6c412d9b6 (patch)
tree593b26dff2da2f364ed1ad97e667d691487d7e69 /drivers/base/power/common.c
parent6fb28badf207a6d8a78906353772e1c3f560a977 (diff)
downloadlinux-fsl-qoriq-dbf374142dd7a3c394ec124ebe7339a6c412d9b6.tar.xz
PM / Domains: Move syscore flag from subsys data to struct device
The syscore device PM flag is used to mark the devices (belonging to a PM domain) that should never be turned off, except for the system core (syscore) suspend/hibernation and resume stages. That flag is stored in the device's struct pm_subsys_data object whose address is available from struct device. However, in some situations it may be convenient to set that flag before the device is added to a PM domain, so it is better to move it directly to the "power" member of struct device. Then, it can be checked by the routines in drivers/base/power/runtime.c and drivers/base/power/main.c, which is more straightforward. This also reduces the number of dev_gpd_data() invocations in the generic PM domains framework, so the overhead related to the syscore flag is slightly smaller. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Magnus Damm <damm@opensource.se>
Diffstat (limited to 'drivers/base/power/common.c')
-rw-r--r--drivers/base/power/common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index 39c3252..cf7a851 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -83,3 +83,18 @@ int dev_pm_put_subsys_data(struct device *dev)
return ret;
}
EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);
+
+/**
+ * dev_pm_syscore_device - Set/unset the given device's power.syscore flag.
+ * @dev: Device whose flag is to be modified.
+ * @val: New value of the flag.
+ */
+void dev_pm_syscore_device(struct device *dev, bool val)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&dev->power.lock, flags);
+ dev->power.syscore = val;
+ spin_unlock_irqrestore(&dev->power.lock, flags);
+}
+EXPORT_SYMBOL_GPL(dev_pm_syscore_device);