* pm-domains: PM / Domains: Fix bad of_node_put() in failure paths of genpd_dev_pm_attach() PM / Domains: Validate cases of a non-bound driver in genpd governor * pm-cpufreq: cpufreq: use last policy after online for drivers with ->setpolicy
Unified · Split
| @@ -1775,10 +1775,10 @@ int genpd_dev_pm_attach(struct device *dev) · 1774 unmodified lines | ||
| 1775 | 1775 | } |
| 1776 | 1776 | |
| 1777 | 1777 | pd = of_genpd_get_from_provider(&pd_args); |
| 1778 | + of_node_put(pd_args.np); | |
| 1778 | 1779 | if (IS_ERR(pd)) { |
| 1779 | 1780 | dev_dbg(dev, "%s() failed to find PM domain: %ld\n", |
| 1780 | 1781 | __func__, PTR_ERR(pd)); |
| 1781 | − of_node_put(dev->of_node); | |
| 1782 | 1782 | return -EPROBE_DEFER; |
| 1783 | 1783 | } |
| 1784 | 1784 | |
| @@ -1796,7 +1796,6 @@ int genpd_dev_pm_attach(struct device *dev) · 11 unmodified lines | ||
| 1796 | 1796 | if (ret < 0) { |
| 1797 | 1797 | dev_err(dev, "failed to add to PM domain %s: %d", |
| 1798 | 1798 | pd->name, ret); |
| 1799 | − of_node_put(dev->of_node); | |
| 1800 | 1799 | goto out; |
| 1801 | 1800 | } |
| 1802 | 1801 | |
| @@ -160,9 +160,6 @@ static bool default_power_down_ok(struct dev_pm_domain *pd) · 159 unmodified lines | ||
| 160 | 160 | struct gpd_timing_data *td; |
| 161 | 161 | s64 constraint_ns; |
| 162 | 162 | |
| 163 | − if (!pdd->dev->driver) | |
| 164 | − continue; | |
| 165 | − | |
| 166 | 163 | /* |
| 167 | 164 | * Check if the device is allowed to be off long enough for the |
| 168 | 165 | * domain to turn off and on (that's how much time it will |
| @@ -976,10 +976,14 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) · 975 unmodified lines | ||
| 976 | 976 | |
| 977 | 977 | new_policy.governor = gov; |
| 978 | 978 | |
| 979 | − /* Use the default policy if its valid. */ | |
| 980 | − if (cpufreq_driver->setpolicy) | |
| 981 | − cpufreq_parse_governor(gov->name, &new_policy.policy, NULL); | |
| 982 | − | |
| 979 | + /* Use the default policy if there is no last_policy. */ | |
| 980 | + if (cpufreq_driver->setpolicy) { | |
| 981 | + if (policy->last_policy) | |
| 982 | + new_policy.policy = policy->last_policy; | |
| 983 | + else | |
| 984 | + cpufreq_parse_governor(gov->name, &new_policy.policy, | |
| 985 | + NULL); | |
| 986 | + } | |
| 983 | 987 | /* set default policy */ |
| 984 | 988 | return cpufreq_set_policy(policy, &new_policy); |
| 985 | 989 | } |
| @@ -1330,6 +1334,8 @@ static void cpufreq_offline_prepare(unsigned int cpu) · 344 unmodified lines | ||
| 1330 | 1334 | if (has_target()) |
| 1331 | 1335 | strncpy(policy->last_governor, policy->governor->name, |
| 1332 | 1336 | CPUFREQ_NAME_LEN); |
| 1337 | + else | |
| 1338 | + policy->last_policy = policy->policy; | |
| 1333 | 1339 | } else if (cpu == policy->cpu) { |
| 1334 | 1340 | /* Nominate new CPU */ |
| 1335 | 1341 | policy->cpu = cpumask_any(policy->cpus); |
| @@ -77,6 +77,7 @@ struct cpufreq_policy { · 76 unmodified lines | ||
| 77 | 77 | unsigned int suspend_freq; /* freq to set during suspend */ |
| 78 | 78 | |
| 79 | 79 | unsigned int policy; /* see above */ |
| 80 | + unsigned int last_policy; /* policy before unplug */ | |
| 80 | 81 | struct cpufreq_governor *governor; /* see below */ |
| 81 | 82 | void *governor_data; |
| 82 | 83 | bool governor_enabled; /* governor start/stop flag */ |