cpufreq.c (4d1f3a5bcb489cc6f7cbc128e0c292fed7868d32) cpufreq.c (a34e63b14486e98cf78c99bf8ef141de7508dbc2)
1/*
2 * linux/drivers/cpufreq/cpufreq.c
3 *
4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * (C) 2013 Viresh Kumar <viresh.kumar@linaro.org>
7 *
8 * Oct 2005 - Ashok Raj <ashok.raj@intel.com>

--- 1076 unchanged lines hidden (view full) ---

1085 pr_err("%s: Failed to start governor\n", __func__);
1086 return ret;
1087 }
1088 }
1089
1090 return 0;
1091}
1092
1/*
2 * linux/drivers/cpufreq/cpufreq.c
3 *
4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * (C) 2013 Viresh Kumar <viresh.kumar@linaro.org>
7 *
8 * Oct 2005 - Ashok Raj <ashok.raj@intel.com>

--- 1076 unchanged lines hidden (view full) ---

1085 pr_err("%s: Failed to start governor\n", __func__);
1086 return ret;
1087 }
1088 }
1089
1090 return 0;
1091}
1092
1093static struct cpufreq_policy *cpufreq_policy_alloc(struct device *dev)
1093static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
1094{
1094{
1095 struct device *dev = get_cpu_device(cpu);
1095 struct cpufreq_policy *policy;
1096 int ret;
1097
1096 struct cpufreq_policy *policy;
1097 int ret;
1098
1099 if (WARN_ON(!dev))
1100 return NULL;
1101
1098 policy = kzalloc(sizeof(*policy), GFP_KERNEL);
1099 if (!policy)
1100 return NULL;
1101
1102 if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL))
1103 goto err_free_policy;
1104
1105 if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL))

--- 11 unchanged lines hidden (view full) ---

1117
1118 INIT_LIST_HEAD(&policy->policy_list);
1119 init_rwsem(&policy->rwsem);
1120 spin_lock_init(&policy->transition_lock);
1121 init_waitqueue_head(&policy->transition_wait);
1122 init_completion(&policy->kobj_unregister);
1123 INIT_WORK(&policy->update, handle_update);
1124
1102 policy = kzalloc(sizeof(*policy), GFP_KERNEL);
1103 if (!policy)
1104 return NULL;
1105
1106 if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL))
1107 goto err_free_policy;
1108
1109 if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL))

--- 11 unchanged lines hidden (view full) ---

1121
1122 INIT_LIST_HEAD(&policy->policy_list);
1123 init_rwsem(&policy->rwsem);
1124 spin_lock_init(&policy->transition_lock);
1125 init_waitqueue_head(&policy->transition_wait);
1126 init_completion(&policy->kobj_unregister);
1127 INIT_WORK(&policy->update, handle_update);
1128
1125 policy->cpu = dev->id;
1129 policy->cpu = cpu;
1126
1127 /* Set this once on allocation */
1130
1131 /* Set this once on allocation */
1128 policy->kobj_cpu = dev->id;
1132 policy->kobj_cpu = cpu;
1129
1130 return policy;
1131
1132err_free_real_cpus:
1133 free_cpumask_var(policy->real_cpus);
1134err_free_rcpumask:
1135 free_cpumask_var(policy->related_cpus);
1136err_free_cpumask:

--- 91 unchanged lines hidden (view full) ---

1228 /* This is the only online CPU for the policy. Start over. */
1229 recover_policy = true;
1230 down_write(&policy->rwsem);
1231 policy->cpu = cpu;
1232 policy->governor = NULL;
1233 up_write(&policy->rwsem);
1234 } else {
1235 recover_policy = false;
1133
1134 return policy;
1135
1136err_free_real_cpus:
1137 free_cpumask_var(policy->real_cpus);
1138err_free_rcpumask:
1139 free_cpumask_var(policy->related_cpus);
1140err_free_cpumask:

--- 91 unchanged lines hidden (view full) ---

1232 /* This is the only online CPU for the policy. Start over. */
1233 recover_policy = true;
1234 down_write(&policy->rwsem);
1235 policy->cpu = cpu;
1236 policy->governor = NULL;
1237 up_write(&policy->rwsem);
1238 } else {
1239 recover_policy = false;
1236 policy = cpufreq_policy_alloc(dev);
1240 policy = cpufreq_policy_alloc(cpu);
1237 if (!policy)
1238 return -ENOMEM;
1239 }
1240
1241 cpumask_copy(policy->cpus, cpumask_of(cpu));
1242
1243 /* call driver. From then on the cpufreq must be able
1244 * to accept all calls to ->verify and ->setpolicy for this CPU

--- 1335 unchanged lines hidden ---
1241 if (!policy)
1242 return -ENOMEM;
1243 }
1244
1245 cpumask_copy(policy->cpus, cpumask_of(cpu));
1246
1247 /* call driver. From then on the cpufreq must be able
1248 * to accept all calls to ->verify and ->setpolicy for this CPU

--- 1335 unchanged lines hidden ---