cpufreq: Don't clip PM QoS requests to old policy limits
Alex Frid [Tue, 15 May 2012 04:06:11 +0000 (21:06 -0700)]
Clipping PM QoS requests to combined old policy limits that include
both PM QoS and user policy requests creates a circular dependency.
As a result new PM QoS maximum limit is rejected if it is above
previous PM QoS minimum limit even though the new PM QoS minimum
limit has been already lowered below new PM QoS maximum limit.

Instead clip PM QoS request to the old user policy limits only.

Change-Id: Ice0a53a699e0798f07f0e32d6b8a28586fe5db0c
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/102386
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Donghan Ryu <dryu@nvidia.com>
Reviewed-by: Antti Miettinen <amiettinen@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Tested-by: Vikas Ramesh Kedigehalli <vikasr@nvidia.com>

drivers/cpufreq/cpufreq.c

index 5bbe8c3..629806d 100644 (file)
@@ -1640,9 +1640,9 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
        unsigned int pmax = policy->max;
 
        qmin = min((unsigned int)pm_qos_request(PM_QOS_CPU_FREQ_MIN),
-                  data->max);
+                  data->user_policy.max);
        qmax = max((unsigned int)pm_qos_request(PM_QOS_CPU_FREQ_MAX),
-                  data->min);
+                  data->user_policy.min);
 
        pr_debug("setting new policy for CPU %u: %u - %u (%u - %u) kHz\n",
                policy->cpu, pmin, pmax, qmin, qmax);
@@ -1654,7 +1654,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
        memcpy(&policy->cpuinfo, &data->cpuinfo,
                                sizeof(struct cpufreq_cpuinfo));
 
-       if (policy->min > data->max || policy->max < data->min) {
+       if (policy->min > data->user_policy.max ||
+           policy->max < data->user_policy.min) {
                ret = -EINVAL;
                goto error_out;
        }