Re: [PATCH] cpufreq: Add scaling frequency range support

From: Viresh Kumar
Date: Wed Jul 29 2015 - 07:01:56 EST


On 29-07-15, 18:04, Pan Xinhui wrote:
> > @@ -622,21 +630,20 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
> > static ssize_t store_##file_name \
> > (struct cpufreq_policy *policy, const char *buf, size_t count) \
> > { \
> > - int ret, temp; \
> > + int ret; \
> > struct cpufreq_policy new_policy; \
> > \
> > ret = cpufreq_get_policy(&new_policy, policy->cpu); \
> > if (ret) \
> > return -EINVAL; \
> > \
> > + cpufreq_get_user_policy_freq(&policy->user_policy, &new_policy);\
> > ret = sscanf(buf, "%u", &new_policy.object); \
> > if (ret != 1) \
> > return -EINVAL; \
> > \
> > - temp = new_policy.object; \
> > - ret = cpufreq_set_policy(policy, &new_policy); \
> > - if (!ret) \
> > - policy->user_policy.object = temp; \
> > + policy->user_policy.object = policy->object; \
> should be
> + policy->user_policy.object = new_policy.object; \
> sorry for that.
> > + ret = cpufreq_set_policy(policy, &new_policy); \

This is wrong because we save user-preference, even when we failed. So that's
surely bad.

--
viresh
--
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/