aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorSudeep Holla <sudeep.holla@arm.com>2019-02-14 13:29:10 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-02-19 04:42:43 -0500
commit85945c28b5a888043cb2b54f880d80d8915f21f5 (patch)
tree35e854cd328ac47247f22fcd0c51550575f3c211 /include/linux/device.h
parent4a0fa9f9fdb5a7230da6fb250c270c01d5f21fb5 (diff)
PM / core: Add support to skip power management in device/driver model
All device objects in the driver model contain fields that control the handling of various power management activities. However, it's not always useful. There are few instances where pseudo devices are added to the model just to take advantage of many other features like kobjects, udev events, and so on. One such example is cpu devices and their caches. The sysfs for the cpu caches are managed by adding devices with cpu as the parent in cpu_device_create() when secondary cpu is brought online. Generally when the secondary CPUs are hotplugged back in as part of resume from suspend-to-ram, we call cpu_device_create() from the cpu hotplug state machine while the cpu device associated with that CPU is not yet ready to be resumed as the device_resume() call happens bit later. It's not really needed to set the flag is_prepared for cpu devices as they are mostly pseudo device and hotplug framework deals with state machine and not managed through the cpu device. This often results in annoying warning when resuming: Enabling non-boot CPUs ... CPU1: Booted secondary processor cache: parent cpu1 should not be sleeping CPU1 is up CPU2: Booted secondary processor cache: parent cpu2 should not be sleeping CPU2 is up .... and so on. So in order to fix these kind of errors, we could just completely avoid doing any power management related initialisations and operations if they are not used by these devices. Add no_pm flags to indicate that the device doesn't require any sort of PM activities and all of them can be completely skipped. We can use the same flag to also avoid adding not used *power* sysfs entries for these devices. For now, lets use this for cpu cache devices. Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Tested-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 6cb4640b6160..53028636fe39 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1165,6 +1165,16 @@ static inline bool device_async_suspend_enabled(struct device *dev)
1165 return !!dev->power.async_suspend; 1165 return !!dev->power.async_suspend;
1166} 1166}
1167 1167
1168static inline bool device_pm_not_required(struct device *dev)
1169{
1170 return dev->power.no_pm;
1171}
1172
1173static inline void device_set_pm_not_required(struct device *dev)
1174{
1175 dev->power.no_pm = true;
1176}
1177
1168static inline void dev_pm_syscore_device(struct device *dev, bool val) 1178static inline void dev_pm_syscore_device(struct device *dev, bool val)
1169{ 1179{
1170#ifdef CONFIG_PM_SLEEP 1180#ifdef CONFIG_PM_SLEEP