Re: [PATCH Resend] cpufreq: remove sysfs files for CPU which failed to come back after resume

From: Rafael J. Wysocki
Date: Mon Dec 23 2013 - 19:22:00 EST


On Monday, December 23, 2013 09:15:40 PM viresh kumar wrote:
> On Monday 23 December 2013 05:12 PM, BjÃrn Mork wrote:
> > That would be great. This could be just me. I am quite good at
> > breaking stuff.
>
> No its not you. While we tried to make sure everything is preserved,
> few special things still stayed out :)
>
> And they are solved with this patch, log should be good enough to give
> proper reasoning:
>
> From: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> Date: Mon, 23 Dec 2013 20:51:54 +0530
> Subject: [PATCH] cpufreq: preserve user_policy across suspend/resume
>
> In __cpufreq_add_dev() we are reinitializing user_policy with default values and
> hence would loose values of user_policy.{min|max|policy|governor} fields.
>
> Preserve them by not overriding these for suspend/resume.

OK

Can you please combine this with the patch you sent previously (if that one
is still necessary) and resubmit with a new subject?

Rafael


> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
> drivers/cpufreq/cpufreq.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 16d7b4a..c5c3dac 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -839,9 +839,6 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy)
>
> /* set default policy */
> ret = cpufreq_set_policy(policy, &new_policy);
> - policy->user_policy.policy = policy->policy;
> - policy->user_policy.governor = policy->governor;
> -
> if (ret) {
> pr_debug("setting policy failed\n");
> if (cpufreq_driver->exit)
> @@ -1069,8 +1066,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
> */
> cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
>
> - policy->user_policy.min = policy->min;
> - policy->user_policy.max = policy->max;
> + if (!frozen) {
> + policy->user_policy.min = policy->min;
> + policy->user_policy.max = policy->max;
> + }
>
> blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
> CPUFREQ_START, policy);
> @@ -1101,6 +1100,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
>
> cpufreq_init_policy(policy);
>
> + if (!frozen) {
> + policy->user_policy.policy = policy->policy;
> + policy->user_policy.governor = policy->governor;
> + }
> +
> kobject_uevent(&policy->kobj, KOBJ_ADD);
> up_read(&cpufreq_rwsem);
>
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/