Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM: Drop CONFIG_PM_RUNTIME from the driver core

After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
selected) PM_RUNTIME is always set if PM is set, so quite a few
depend on CONFIG_PM or even may be dropped entirely in some cases.

Replace CONFIG_PM_RUNTIME with CONFIG_PM in the PM core code.

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

+60 -216
+2 -67
drivers/base/power/clock_ops.c
··· 256 256 } 257 257 } 258 258 259 - #endif /* CONFIG_PM */ 260 - 261 - #ifdef CONFIG_PM_RUNTIME 262 - 263 259 /** 264 260 * pm_clk_suspend - Disable clocks in a device's PM clock list. 265 261 * @dev: Device to disable the clocks for. ··· 369 373 return 0; 370 374 } 371 375 372 - #else /* !CONFIG_PM_RUNTIME */ 373 - 374 - #ifdef CONFIG_PM 375 - 376 - /** 377 - * pm_clk_suspend - Disable clocks in a device's PM clock list. 378 - * @dev: Device to disable the clocks for. 379 - */ 380 - int pm_clk_suspend(struct device *dev) 381 - { 382 - struct pm_subsys_data *psd = dev_to_psd(dev); 383 - struct pm_clock_entry *ce; 384 - unsigned long flags; 385 - 386 - dev_dbg(dev, "%s()\n", __func__); 387 - 388 - /* If there is no driver, the clocks are already disabled. */ 389 - if (!psd || !dev->driver) 390 - return 0; 391 - 392 - spin_lock_irqsave(&psd->lock, flags); 393 - 394 - list_for_each_entry_reverse(ce, &psd->clock_list, node) { 395 - if (ce->status < PCE_STATUS_ERROR) { 396 - if (ce->status == PCE_STATUS_ENABLED) 397 - clk_disable(ce->clk); 398 - ce->status = PCE_STATUS_ACQUIRED; 399 - } 400 - } 401 - 402 - spin_unlock_irqrestore(&psd->lock, flags); 403 - 404 - return 0; 405 - } 406 - 407 - /** 408 - * pm_clk_resume - Enable clocks in a device's PM clock list. 409 - * @dev: Device to enable the clocks for. 410 - */ 411 - int pm_clk_resume(struct device *dev) 412 - { 413 - struct pm_subsys_data *psd = dev_to_psd(dev); 414 - struct pm_clock_entry *ce; 415 - unsigned long flags; 416 - 417 - dev_dbg(dev, "%s()\n", __func__); 418 - 419 - /* If there is no driver, the clocks should remain disabled. */ 420 - if (!psd || !dev->driver) 421 - return 0; 422 - 423 - spin_lock_irqsave(&psd->lock, flags); 424 - 425 - list_for_each_entry(ce, &psd->clock_list, node) 426 - __pm_clk_enable(dev, ce); 427 - 428 - spin_unlock_irqrestore(&psd->lock, flags); 429 - 430 - return 0; 431 - } 432 - 433 - #endif /* CONFIG_PM */ 376 + #else /* !CONFIG_PM */ 434 377 435 378 /** 436 379 * enable_clock - Enable a device clock. ··· 449 514 return 0; 450 515 } 451 516 452 - #endif /* !CONFIG_PM_RUNTIME */ 517 + #endif /* !CONFIG_PM */ 453 518 454 519 /** 455 520 * pm_clk_add_notifier - Add bus type notifier for power management clocks.
+3 -31
drivers/base/power/domain.c
··· 280 280 return genpd ? pm_genpd_poweron(genpd) : -EINVAL; 281 281 } 282 282 283 - #ifdef CONFIG_PM_RUNTIME 284 - 285 283 static int genpd_start_dev_no_timing(struct generic_pm_domain *genpd, 286 284 struct device *dev) 287 285 { ··· 752 754 return 0; 753 755 } 754 756 late_initcall(genpd_poweroff_unused); 755 - 756 - #else 757 - 758 - static inline int genpd_dev_pm_qos_notifier(struct notifier_block *nb, 759 - unsigned long val, void *ptr) 760 - { 761 - return NOTIFY_DONE; 762 - } 763 - 764 - static inline void 765 - genpd_queue_power_off_work(struct generic_pm_domain *genpd) {} 766 - 767 - static inline void genpd_power_off_work_fn(struct work_struct *work) {} 768 - 769 - #define pm_genpd_runtime_suspend NULL 770 - #define pm_genpd_runtime_resume NULL 771 - 772 - #endif /* CONFIG_PM_RUNTIME */ 773 757 774 758 #ifdef CONFIG_PM_SLEEP 775 759 ··· 1344 1364 } 1345 1365 EXPORT_SYMBOL_GPL(pm_genpd_syscore_poweron); 1346 1366 1347 - #else 1367 + #else /* !CONFIG_PM_SLEEP */ 1348 1368 1349 1369 #define pm_genpd_prepare NULL 1350 1370 #define pm_genpd_suspend NULL ··· 2200 2220 return 0; 2201 2221 } 2202 2222 EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); 2203 - #endif 2223 + #endif /* CONFIG_PM_GENERIC_DOMAINS_OF */ 2204 2224 2205 2225 2206 2226 /*** debugfs support ***/ ··· 2216 2236 2217 2237 /* 2218 2238 * TODO: This function is a slightly modified version of rtpm_status_show 2219 - * from sysfs.c, but dependencies between PM_GENERIC_DOMAINS and PM_RUNTIME 2220 - * are too loose to generalize it. 2239 + * from sysfs.c, so generalize it. 2221 2240 */ 2222 - #ifdef CONFIG_PM_RUNTIME 2223 2241 static void rtpm_status_str(struct seq_file *s, struct device *dev) 2224 2242 { 2225 2243 static const char * const status_lookup[] = { ··· 2239 2261 2240 2262 seq_puts(s, p); 2241 2263 } 2242 - #else 2243 - static void rtpm_status_str(struct seq_file *s, struct device *dev) 2244 - { 2245 - seq_puts(s, "active"); 2246 - } 2247 - #endif 2248 2264 2249 2265 static int pm_genpd_summary_one(struct seq_file *s, 2250 2266 struct generic_pm_domain *gpd)
-11
drivers/base/power/domain_governor.c
··· 11 11 #include <linux/pm_qos.h> 12 12 #include <linux/hrtimer.h> 13 13 14 - #ifdef CONFIG_PM_RUNTIME 15 - 16 14 static int dev_update_qos_constraint(struct device *dev, void *data) 17 15 { 18 16 s64 *constraint_ns_p = data; ··· 224 226 { 225 227 return false; 226 228 } 227 - 228 - #else /* !CONFIG_PM_RUNTIME */ 229 - 230 - static inline bool default_stop_ok(struct device *dev) { return false; } 231 - 232 - #define default_power_down_ok NULL 233 - #define always_on_power_down_ok NULL 234 - 235 - #endif /* !CONFIG_PM_RUNTIME */ 236 229 237 230 struct dev_power_governor simple_qos_governor = { 238 231 .stop_ok = default_stop_ok,
+25 -31
drivers/base/power/power.h
··· 9 9 } 10 10 } 11 11 12 - #ifdef CONFIG_PM_RUNTIME 12 + #ifdef CONFIG_PM 13 13 14 14 static inline void pm_runtime_early_init(struct device *dev) 15 15 { ··· 20 20 extern void pm_runtime_init(struct device *dev); 21 21 extern void pm_runtime_remove(struct device *dev); 22 22 23 - #else /* !CONFIG_PM_RUNTIME */ 23 + /* 24 + * sysfs.c 25 + */ 26 + 27 + extern int dpm_sysfs_add(struct device *dev); 28 + extern void dpm_sysfs_remove(struct device *dev); 29 + extern void rpm_sysfs_remove(struct device *dev); 30 + extern int wakeup_sysfs_add(struct device *dev); 31 + extern void wakeup_sysfs_remove(struct device *dev); 32 + extern int pm_qos_sysfs_add_resume_latency(struct device *dev); 33 + extern void pm_qos_sysfs_remove_resume_latency(struct device *dev); 34 + extern int pm_qos_sysfs_add_flags(struct device *dev); 35 + extern void pm_qos_sysfs_remove_flags(struct device *dev); 36 + 37 + #else /* CONFIG_PM */ 24 38 25 39 static inline void pm_runtime_early_init(struct device *dev) 26 40 { ··· 44 30 static inline void pm_runtime_init(struct device *dev) {} 45 31 static inline void pm_runtime_remove(struct device *dev) {} 46 32 47 - #endif /* !CONFIG_PM_RUNTIME */ 33 + static inline int dpm_sysfs_add(struct device *dev) { return 0; } 34 + static inline void dpm_sysfs_remove(struct device *dev) {} 35 + static inline void rpm_sysfs_remove(struct device *dev) {} 36 + static inline int wakeup_sysfs_add(struct device *dev) { return 0; } 37 + static inline void wakeup_sysfs_remove(struct device *dev) {} 38 + static inline int pm_qos_sysfs_add(struct device *dev) { return 0; } 39 + static inline void pm_qos_sysfs_remove(struct device *dev) {} 40 + 41 + #endif 48 42 49 43 #ifdef CONFIG_PM_SLEEP 50 44 ··· 99 77 device_pm_sleep_init(dev); 100 78 pm_runtime_init(dev); 101 79 } 102 - 103 - #ifdef CONFIG_PM 104 - 105 - /* 106 - * sysfs.c 107 - */ 108 - 109 - extern int dpm_sysfs_add(struct device *dev); 110 - extern void dpm_sysfs_remove(struct device *dev); 111 - extern void rpm_sysfs_remove(struct device *dev); 112 - extern int wakeup_sysfs_add(struct device *dev); 113 - extern void wakeup_sysfs_remove(struct device *dev); 114 - extern int pm_qos_sysfs_add_resume_latency(struct device *dev); 115 - extern void pm_qos_sysfs_remove_resume_latency(struct device *dev); 116 - extern int pm_qos_sysfs_add_flags(struct device *dev); 117 - extern void pm_qos_sysfs_remove_flags(struct device *dev); 118 - 119 - #else /* CONFIG_PM */ 120 - 121 - static inline int dpm_sysfs_add(struct device *dev) { return 0; } 122 - static inline void dpm_sysfs_remove(struct device *dev) {} 123 - static inline void rpm_sysfs_remove(struct device *dev) {} 124 - static inline int wakeup_sysfs_add(struct device *dev) { return 0; } 125 - static inline void wakeup_sysfs_remove(struct device *dev) {} 126 - static inline int pm_qos_sysfs_add(struct device *dev) { return 0; } 127 - static inline void pm_qos_sysfs_remove(struct device *dev) {} 128 - 129 - #endif
-5
drivers/base/power/qos.c
··· 599 599 } 600 600 EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request); 601 601 602 - #ifdef CONFIG_PM_RUNTIME 603 602 static void __dev_pm_qos_drop_user_request(struct device *dev, 604 603 enum dev_pm_qos_req_type type) 605 604 { ··· 879 880 mutex_unlock(&dev_pm_qos_mtx); 880 881 return ret; 881 882 } 882 - #else /* !CONFIG_PM_RUNTIME */ 883 - static void __dev_pm_qos_hide_latency_limit(struct device *dev) {} 884 - static void __dev_pm_qos_hide_flags(struct device *dev) {} 885 - #endif /* CONFIG_PM_RUNTIME */
-9
drivers/base/power/runtime.c
··· 45 45 #define RPM_GET_CALLBACK(dev, callback) \ 46 46 __rpm_get_callback(dev, offsetof(struct dev_pm_ops, callback)) 47 47 48 - #ifdef CONFIG_PM_RUNTIME 49 - 50 48 static int rpm_resume(struct device *dev, int rpmflags); 51 49 static int rpm_suspend(struct device *dev, int rpmflags); 52 50 ··· 1397 1399 if (dev->power.irq_safe && dev->parent) 1398 1400 pm_runtime_put(dev->parent); 1399 1401 } 1400 - #endif 1401 1402 1402 1403 /** 1403 1404 * pm_runtime_force_suspend - Force a device into suspend state if needed. ··· 1416 1419 int ret = 0; 1417 1420 1418 1421 pm_runtime_disable(dev); 1419 - 1420 - /* 1421 - * Note that pm_runtime_status_suspended() returns false while 1422 - * !CONFIG_PM_RUNTIME, which means the device will be put into low 1423 - * power state. 1424 - */ 1425 1422 if (pm_runtime_status_suspended(dev)) 1426 1423 return 0; 1427 1424
+1 -18
drivers/base/power/sysfs.c
··· 95 95 const char power_group_name[] = "power"; 96 96 EXPORT_SYMBOL_GPL(power_group_name); 97 97 98 - #ifdef CONFIG_PM_RUNTIME 99 98 static const char ctrl_auto[] = "auto"; 100 99 static const char ctrl_on[] = "on"; 101 100 ··· 329 330 330 331 static DEVICE_ATTR(pm_qos_remote_wakeup, 0644, 331 332 pm_qos_remote_wakeup_show, pm_qos_remote_wakeup_store); 332 - #endif /* CONFIG_PM_RUNTIME */ 333 333 334 334 #ifdef CONFIG_PM_SLEEP 335 335 static const char _enabled[] = "enabled"; ··· 529 531 #endif /* CONFIG_PM_SLEEP */ 530 532 531 533 #ifdef CONFIG_PM_ADVANCED_DEBUG 532 - #ifdef CONFIG_PM_RUNTIME 533 - 534 534 static ssize_t rtpm_usagecount_show(struct device *dev, 535 535 struct device_attribute *attr, char *buf) 536 536 { ··· 558 562 static DEVICE_ATTR(runtime_active_kids, 0444, rtpm_children_show, NULL); 559 563 static DEVICE_ATTR(runtime_enabled, 0444, rtpm_enabled_show, NULL); 560 564 561 - #endif 562 - 563 565 #ifdef CONFIG_PM_SLEEP 564 - 565 566 static ssize_t async_show(struct device *dev, struct device_attribute *attr, 566 567 char *buf) 567 568 { ··· 588 595 589 596 static DEVICE_ATTR(async, 0644, async_show, async_store); 590 597 591 - #endif 598 + #endif /* CONFIG_PM_SLEEP */ 592 599 #endif /* CONFIG_PM_ADVANCED_DEBUG */ 593 600 594 601 static struct attribute *power_attrs[] = { ··· 596 603 #ifdef CONFIG_PM_SLEEP 597 604 &dev_attr_async.attr, 598 605 #endif 599 - #ifdef CONFIG_PM_RUNTIME 600 606 &dev_attr_runtime_status.attr, 601 607 &dev_attr_runtime_usage.attr, 602 608 &dev_attr_runtime_active_kids.attr, 603 609 &dev_attr_runtime_enabled.attr, 604 - #endif 605 610 #endif /* CONFIG_PM_ADVANCED_DEBUG */ 606 611 NULL, 607 612 }; ··· 631 640 }; 632 641 633 642 static struct attribute *runtime_attrs[] = { 634 - #ifdef CONFIG_PM_RUNTIME 635 643 #ifndef CONFIG_PM_ADVANCED_DEBUG 636 644 &dev_attr_runtime_status.attr, 637 645 #endif ··· 638 648 &dev_attr_runtime_suspended_time.attr, 639 649 &dev_attr_runtime_active_time.attr, 640 650 &dev_attr_autosuspend_delay_ms.attr, 641 - #endif /* CONFIG_PM_RUNTIME */ 642 651 NULL, 643 652 }; 644 653 static struct attribute_group pm_runtime_attr_group = { ··· 646 657 }; 647 658 648 659 static struct attribute *pm_qos_resume_latency_attrs[] = { 649 - #ifdef CONFIG_PM_RUNTIME 650 660 &dev_attr_pm_qos_resume_latency_us.attr, 651 - #endif /* CONFIG_PM_RUNTIME */ 652 661 NULL, 653 662 }; 654 663 static struct attribute_group pm_qos_resume_latency_attr_group = { ··· 655 668 }; 656 669 657 670 static struct attribute *pm_qos_latency_tolerance_attrs[] = { 658 - #ifdef CONFIG_PM_RUNTIME 659 671 &dev_attr_pm_qos_latency_tolerance_us.attr, 660 - #endif /* CONFIG_PM_RUNTIME */ 661 672 NULL, 662 673 }; 663 674 static struct attribute_group pm_qos_latency_tolerance_attr_group = { ··· 664 679 }; 665 680 666 681 static struct attribute *pm_qos_flags_attrs[] = { 667 - #ifdef CONFIG_PM_RUNTIME 668 682 &dev_attr_pm_qos_no_power_off.attr, 669 683 &dev_attr_pm_qos_remote_wakeup.attr, 670 - #endif /* CONFIG_PM_RUNTIME */ 671 684 NULL, 672 685 }; 673 686 static struct attribute_group pm_qos_flags_attr_group = {
+1 -1
include/linux/pm.h
··· 576 576 #else 577 577 unsigned int should_wakeup:1; 578 578 #endif 579 - #ifdef CONFIG_PM_RUNTIME 579 + #ifdef CONFIG_PM 580 580 struct timer_list suspend_timer; 581 581 unsigned long timer_expires; 582 582 struct work_struct work;
+2 -6
include/linux/pm_domain.h
··· 147 147 148 148 extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 149 149 extern int pm_genpd_name_poweron(const char *domain_name); 150 + extern void pm_genpd_poweroff_unused(void); 150 151 151 152 extern struct dev_power_governor simple_qos_governor; 152 153 extern struct dev_power_governor pm_domain_always_on_gov; ··· 222 221 { 223 222 return -ENOSYS; 224 223 } 224 + static inline void pm_genpd_poweroff_unused(void) {} 225 225 #define simple_qos_governor NULL 226 226 #define pm_domain_always_on_gov NULL 227 227 #endif ··· 238 236 { 239 237 return __pm_genpd_name_add_device(domain_name, dev, NULL); 240 238 } 241 - 242 - #ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME 243 - extern void pm_genpd_poweroff_unused(void); 244 - #else 245 - static inline void pm_genpd_poweroff_unused(void) {} 246 - #endif 247 239 248 240 #ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP 249 241 extern void pm_genpd_syscore_poweroff(struct device *dev);
+17 -21
include/linux/pm_qos.h
··· 154 154 int dev_pm_qos_add_ancestor_request(struct device *dev, 155 155 struct dev_pm_qos_request *req, 156 156 enum dev_pm_qos_req_type type, s32 value); 157 + int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value); 158 + void dev_pm_qos_hide_latency_limit(struct device *dev); 159 + int dev_pm_qos_expose_flags(struct device *dev, s32 value); 160 + void dev_pm_qos_hide_flags(struct device *dev); 161 + int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set); 162 + s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev); 163 + int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val); 164 + 165 + static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) 166 + { 167 + return dev->power.qos->resume_latency_req->data.pnode.prio; 168 + } 169 + 170 + static inline s32 dev_pm_qos_requested_flags(struct device *dev) 171 + { 172 + return dev->power.qos->flags_req->data.flr.flags; 173 + } 157 174 #else 158 175 static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, 159 176 s32 mask) ··· 217 200 enum dev_pm_qos_req_type type, 218 201 s32 value) 219 202 { return 0; } 220 - #endif 221 - 222 - #ifdef CONFIG_PM_RUNTIME 223 - int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value); 224 - void dev_pm_qos_hide_latency_limit(struct device *dev); 225 - int dev_pm_qos_expose_flags(struct device *dev, s32 value); 226 - void dev_pm_qos_hide_flags(struct device *dev); 227 - int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set); 228 - s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev); 229 - int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val); 230 - 231 - static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) 232 - { 233 - return dev->power.qos->resume_latency_req->data.pnode.prio; 234 - } 235 - 236 - static inline s32 dev_pm_qos_requested_flags(struct device *dev) 237 - { 238 - return dev->power.qos->flags_req->data.flr.flags; 239 - } 240 - #else 241 203 static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) 242 204 { return 0; } 243 205 static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {}
+9 -12
include/linux/pm_runtime.h
··· 35 35 extern int pm_generic_runtime_resume(struct device *dev); 36 36 extern int pm_runtime_force_suspend(struct device *dev); 37 37 extern int pm_runtime_force_resume(struct device *dev); 38 - #else 39 - static inline bool queue_pm_work(struct work_struct *work) { return false; } 40 - 41 - static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 42 - static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 43 - static inline int pm_runtime_force_suspend(struct device *dev) { return 0; } 44 - static inline int pm_runtime_force_resume(struct device *dev) { return 0; } 45 - #endif 46 - 47 - #ifdef CONFIG_PM_RUNTIME 48 38 49 39 extern int __pm_runtime_idle(struct device *dev, int rpmflags); 50 40 extern int __pm_runtime_suspend(struct device *dev, int rpmflags); ··· 118 128 ACCESS_ONCE(dev->power.last_busy) = jiffies; 119 129 } 120 130 121 - #else /* !CONFIG_PM_RUNTIME */ 131 + #else /* !CONFIG_PM */ 132 + 133 + static inline bool queue_pm_work(struct work_struct *work) { return false; } 134 + 135 + static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 136 + static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 137 + static inline int pm_runtime_force_suspend(struct device *dev) { return 0; } 138 + static inline int pm_runtime_force_resume(struct device *dev) { return 0; } 122 139 123 140 static inline int __pm_runtime_idle(struct device *dev, int rpmflags) 124 141 { ··· 176 179 static inline void pm_runtime_set_memalloc_noio(struct device *dev, 177 180 bool enable){} 178 181 179 - #endif /* !CONFIG_PM_RUNTIME */ 182 + #endif /* !CONFIG_PM */ 180 183 181 184 static inline int pm_runtime_idle(struct device *dev) 182 185 {
-4
kernel/power/Kconfig
··· 298 298 def_bool y 299 299 depends on PM_SLEEP && PM_GENERIC_DOMAINS 300 300 301 - config PM_GENERIC_DOMAINS_RUNTIME 302 - def_bool y 303 - depends on PM_RUNTIME && PM_GENERIC_DOMAINS 304 - 305 301 config PM_GENERIC_DOMAINS_OF 306 302 def_bool y 307 303 depends on PM_GENERIC_DOMAINS && OF