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

Merge branches 'pm-cpufreq', 'pm-cpuidle' and 'pm-core'

* pm-cpufreq:
cpufreq: schedutil: Improve prints messages with pr_fmt
cpufreq: simplified goto out in cpufreq_register_driver()
cpufreq: governor: CPUFREQ_GOV_STOP never fails
cpufreq: governor: CPUFREQ_GOV_POLICY_EXIT never fails
intel_pstate: Simplify conditional in intel_pstate_set_policy()

* pm-cpuidle:
cpuidle: Fix cpuidle_state_is_coupled() argument in cpuidle_enter()

* pm-core:
PM / sleep: Handle failures in device_suspend_late() consistently

+39 -67
+3 -2
drivers/base/power/main.c
··· 1267 1267 error = device_suspend_late(dev); 1268 1268 1269 1269 mutex_lock(&dpm_list_mtx); 1270 + if (!list_empty(&dev->power.entry)) 1271 + list_move(&dev->power.entry, &dpm_late_early_list); 1272 + 1270 1273 if (error) { 1271 1274 pm_dev_err(dev, state, " late", error); 1272 1275 dpm_save_failed_dev(dev_name(dev)); 1273 1276 put_device(dev); 1274 1277 break; 1275 1278 } 1276 - if (!list_empty(&dev->power.entry)) 1277 - list_move(&dev->power.entry, &dpm_late_early_list); 1278 1279 put_device(dev); 1279 1280 1280 1281 if (async_error)
+27 -57
drivers/cpufreq/cpufreq.c
··· 78 78 static unsigned int __cpufreq_get(struct cpufreq_policy *policy); 79 79 static int cpufreq_start_governor(struct cpufreq_policy *policy); 80 80 81 - static inline int cpufreq_exit_governor(struct cpufreq_policy *policy) 81 + static inline void cpufreq_exit_governor(struct cpufreq_policy *policy) 82 82 { 83 - return cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); 83 + (void)cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); 84 + } 85 + 86 + static inline void cpufreq_stop_governor(struct cpufreq_policy *policy) 87 + { 88 + (void)cpufreq_governor(policy, CPUFREQ_GOV_STOP); 84 89 } 85 90 86 91 /** ··· 1031 1026 return 0; 1032 1027 1033 1028 down_write(&policy->rwsem); 1034 - if (has_target()) { 1035 - ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP); 1036 - if (ret) { 1037 - pr_err("%s: Failed to stop governor\n", __func__); 1038 - goto unlock; 1039 - } 1040 - } 1029 + if (has_target()) 1030 + cpufreq_stop_governor(policy); 1041 1031 1042 1032 cpumask_set_cpu(cpu, policy->cpus); 1043 1033 ··· 1041 1041 if (ret) 1042 1042 pr_err("%s: Failed to start governor\n", __func__); 1043 1043 } 1044 - 1045 - unlock: 1046 1044 up_write(&policy->rwsem); 1047 1045 return ret; 1048 1046 } ··· 1352 1354 } 1353 1355 1354 1356 down_write(&policy->rwsem); 1355 - if (has_target()) { 1356 - ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP); 1357 - if (ret) 1358 - pr_err("%s: Failed to stop governor\n", __func__); 1359 - } 1357 + if (has_target()) 1358 + cpufreq_stop_governor(policy); 1360 1359 1361 1360 cpumask_clear_cpu(cpu, policy->cpus); 1362 1361 ··· 1382 1387 if (cpufreq_driver->stop_cpu) 1383 1388 cpufreq_driver->stop_cpu(policy); 1384 1389 1385 - /* If cpu is last user of policy, free policy */ 1386 - if (has_target()) { 1387 - ret = cpufreq_exit_governor(policy); 1388 - if (ret) 1389 - pr_err("%s: Failed to exit governor\n", __func__); 1390 - } 1390 + if (has_target()) 1391 + cpufreq_exit_governor(policy); 1391 1392 1392 1393 /* 1393 1394 * Perform the ->exit() even during light-weight tear-down, ··· 1617 1626 void cpufreq_suspend(void) 1618 1627 { 1619 1628 struct cpufreq_policy *policy; 1620 - int ret; 1621 1629 1622 1630 if (!cpufreq_driver) 1623 1631 return; ··· 1629 1639 for_each_active_policy(policy) { 1630 1640 if (has_target()) { 1631 1641 down_write(&policy->rwsem); 1632 - ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP); 1642 + cpufreq_stop_governor(policy); 1633 1643 up_write(&policy->rwsem); 1634 - 1635 - if (ret) { 1636 - pr_err("%s: Failed to stop governor for policy: %p\n", 1637 - __func__, policy); 1638 - continue; 1639 - } 1640 1644 } 1641 1645 1642 1646 if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy)) ··· 2033 2049 2034 2050 ret = policy->governor->governor(policy, event); 2035 2051 2036 - if (!ret) { 2037 - if (event == CPUFREQ_GOV_POLICY_INIT) 2052 + if (event == CPUFREQ_GOV_POLICY_INIT) { 2053 + if (ret) 2054 + module_put(policy->governor->owner); 2055 + else 2038 2056 policy->governor->initialized++; 2039 - else if (event == CPUFREQ_GOV_POLICY_EXIT) 2040 - policy->governor->initialized--; 2041 - } 2042 - 2043 - if (((event == CPUFREQ_GOV_POLICY_INIT) && ret) || 2044 - ((event == CPUFREQ_GOV_POLICY_EXIT) && !ret)) 2057 + } else if (event == CPUFREQ_GOV_POLICY_EXIT) { 2058 + policy->governor->initialized--; 2045 2059 module_put(policy->governor->owner); 2060 + } 2046 2061 2047 2062 return ret; 2048 2063 } ··· 2204 2221 old_gov = policy->governor; 2205 2222 /* end old governor */ 2206 2223 if (old_gov) { 2207 - ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP); 2208 - if (ret) { 2209 - /* This can happen due to race with other operations */ 2210 - pr_debug("%s: Failed to Stop Governor: %s (%d)\n", 2211 - __func__, old_gov->name, ret); 2212 - return ret; 2213 - } 2214 - 2215 - ret = cpufreq_exit_governor(policy); 2216 - if (ret) { 2217 - pr_err("%s: Failed to Exit Governor: %s (%d)\n", 2218 - __func__, old_gov->name, ret); 2219 - return ret; 2220 - } 2224 + cpufreq_stop_governor(policy); 2225 + cpufreq_exit_governor(policy); 2221 2226 } 2222 2227 2223 2228 /* start new governor */ ··· 2466 2495 2467 2496 register_hotcpu_notifier(&cpufreq_cpu_notifier); 2468 2497 pr_debug("driver %s up and running\n", driver_data->name); 2469 - 2470 - out: 2471 - put_online_cpus(); 2472 - return ret; 2498 + goto out; 2473 2499 2474 2500 err_if_unreg: 2475 2501 subsys_interface_unregister(&cpufreq_interface); ··· 2476 2508 write_lock_irqsave(&cpufreq_driver_lock, flags); 2477 2509 cpufreq_driver = NULL; 2478 2510 write_unlock_irqrestore(&cpufreq_driver_lock, flags); 2479 - goto out; 2511 + out: 2512 + put_online_cpus(); 2513 + return ret; 2480 2514 } 2481 2515 EXPORT_SYMBOL_GPL(cpufreq_register_driver); 2482 2516
+5 -6
drivers/cpufreq/intel_pstate.c
··· 1461 1461 intel_pstate_clear_update_util_hook(policy->cpu); 1462 1462 1463 1463 cpu = all_cpu_data[0]; 1464 - if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate) { 1465 - if (policy->max < policy->cpuinfo.max_freq && 1466 - policy->max > cpu->pstate.max_pstate * cpu->pstate.scaling) { 1467 - pr_debug("policy->max > max non turbo frequency\n"); 1468 - policy->max = policy->cpuinfo.max_freq; 1469 - } 1464 + if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate && 1465 + policy->max < policy->cpuinfo.max_freq && 1466 + policy->max > cpu->pstate.max_pstate * cpu->pstate.scaling) { 1467 + pr_debug("policy->max > max non turbo frequency\n"); 1468 + policy->max = policy->cpuinfo.max_freq; 1470 1469 } 1471 1470 1472 1471 if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
+1 -1
drivers/cpuidle/cpuidle.c
··· 214 214 tick_broadcast_exit(); 215 215 } 216 216 217 - if (!cpuidle_state_is_coupled(drv, entered_state)) 217 + if (!cpuidle_state_is_coupled(drv, index)) 218 218 local_irq_enable(); 219 219 220 220 /*
+3 -1
kernel/sched/cpufreq_schedutil.c
··· 9 9 * published by the Free Software Foundation. 10 10 */ 11 11 12 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 13 + 12 14 #include <linux/cpufreq.h> 13 15 #include <linux/module.h> 14 16 #include <linux/slab.h> ··· 390 388 mutex_unlock(&global_tunables_lock); 391 389 392 390 sugov_policy_free(sg_policy); 393 - pr_err("cpufreq: schedutil governor initialization failed (error %d)\n", ret); 391 + pr_err("initialization failed (error %d)\n", ret); 394 392 return ret; 395 393 } 396 394