This patch changes the return type of the cpufreq policy-verifying and
applying functions from void to int. This is a first step towards
UltraSPARC support - there might be no common subset of possible
frequencies, so there would be nothing that verify could do on
CPUFREQ_ALL_CPUS. Also, make the first setpolicy call actually work on
all cpufreq drivers.
Dominik
--- linux-2545original/include/linux/cpufreq.h Thu Oct 31 12:00:00 2002
+++ linux/include/linux/cpufreq.h Thu Oct 31 23:00:00 2002
@@ -104,7 +104,7 @@
* CPUFREQ DRIVER INTERFACE *
*********************************************************************/
-typedef void (*cpufreq_policy_t) (struct cpufreq_policy *policy);
+typedef int (*cpufreq_policy_t) (struct cpufreq_policy *policy);
struct cpufreq_driver {
/* needed by all drivers */
--- linux-2545original/kernel/cpufreq.c Thu Oct 31 12:00:00 2002
+++ linux/kernel/cpufreq.c Thu Oct 31 23:00:00 2002
@@ -825,6 +825,7 @@
int cpufreq_set_policy(struct cpufreq_policy *policy)
{
unsigned int i;
+ int ret;
down(&cpufreq_driver_sem);
if (!cpufreq_driver || !cpufreq_driver->verify ||
@@ -834,12 +835,16 @@
return -EINVAL;
}
- down(&cpufreq_notifier_sem);
-
policy->max_cpu_freq = cpufreq_driver->policy[0].max_cpu_freq;
/* verify the cpu speed can be set within this limit */
- cpufreq_driver->verify(policy);
+ ret = cpufreq_driver->verify(policy);
+ if (ret) {
+ up(&cpufreq_driver_sem);
+ return ret;
+ }
+
+ down(&cpufreq_notifier_sem);
/* adjust if neccessary - all reasons */
notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_ADJUST,
@@ -851,7 +856,12 @@
/* verify the cpu speed can be set within this limit,
which might be different to the first one */
- cpufreq_driver->verify(policy);
+ ret = cpufreq_driver->verify(policy);
+ if (ret) {
+ up(&cpufreq_notifier_sem);
+ up(&cpufreq_driver_sem);
+ return ret;
+ }
/* notification of the new policy */
notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_NOTIFY,
@@ -879,11 +889,11 @@
cpu_cur_freq[policy->cpu] = policy->max;
#endif
- cpufreq_driver->setpolicy(policy);
+ ret = cpufreq_driver->setpolicy(policy);
up(&cpufreq_driver_sem);
- return 0;
+ return ret;
}
EXPORT_SYMBOL(cpufreq_set_policy);
--- linux-2545original/Documentation/cpufreq Thu Oct 31 12:00:00 2002
+++ linux/Documentation/cpufreq Thu Oct 31 23:00:00 2002
@@ -87,7 +87,8 @@
Transmeta Crusoe Longrun:
Transmeta Crusoe processors:
--------------------------------
- Does not work with the 2.4. /proc/sys/cpu/ interface.
+ It is recommended to use the 2.6. /proc/cpufreq interface when
+ using this driver
@@ -283,15 +284,17 @@
cpufreq_verify_t verify: This is a pointer to a function with the
following definition:
- void verify_function (struct cpufreq_policy *policy).
+ int verify_function (struct cpufreq_policy *policy).
This function must verify the new policy is within the limits
supported by the CPU, and at least one supported CPU is within
this range. It may be useful to use cpufreq.h /
- cpufreq_verify_within_limits for this.
+ cpufreq_verify_within_limits for this. If this is called with
+ CPUFREQ_ALL_CPUS, and there is no common subset of frequencies
+ for all CPUs, exit with an error.
cpufreq_setpolicy_t setpolicy: This is a pointer to a function with
the following definition:
- void setpolicy_function (struct cpufreq_policy *policy).
+ int setpolicy_function (struct cpufreq_policy *policy).
This function must set the CPU to the new policy. If it is a
"dumb" CPU which only allows fixed frequencies to be set, it
shall set it to the lowest within the limit for
@@ -318,14 +321,14 @@
Some Requirements to CPUFreq architecture drivers
-------------------------------------------------
* Only call cpufreq_register() when the ability to switch CPU
- frequencies is _verified_ or can't be missing
+ frequencies is _verified_ or can't be missing. Also, all
+ other initialization must be done beofre this call, as
+ cpfureq_register calls the driver's verify and setpolicy code for
+ each CPU.
* cpufreq_unregister() may only be called if cpufreq_register() has
been successfully(!) called before.
* kfree() the struct cpufreq_driver only after the call to
cpufreq_unregister(), unless cpufreq_register() failed.
-* Be aware that there is currently no error management in the
- setpolicy() code in the CPUFreq core. So only call yourself a
- cpufreq_driver if you are really a working cpufreq_driver!
--- linux-2545original/drivers/acpi/processor.c Thu Oct 31 12:00:00 2002
+++ linux/drivers/acpi/processor.c Thu Oct 31 23:00:00 2002
@@ -1613,7 +1613,7 @@
cpufreq interface
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCESSOR_PERF
-static void
+static int
acpi_cpufreq_setpolicy (
struct cpufreq_policy *policy)
{
@@ -1626,7 +1626,7 @@
ACPI_FUNCTION_TRACE("acpi_cpufreq_setpolicy");
if (!policy)
- return_VOID;
+ return_VALUE(-EINVAL);
/* get a present, initialized CPU */
if (policy->cpu == CPUFREQ_ALL_CPUS)
@@ -1644,7 +1644,7 @@
cpu = policy->cpu;
pr = processors[cpu];
if (!pr)
- return_VOID;
+ return_VALUE(-EINVAL);
}
/* select appropriate P-State */
@@ -1686,11 +1686,11 @@
result = acpi_processor_set_performance (pr, next_state);
}
- return_VOID;
+ return_VALUE(0);
}
-static void
+static int
acpi_cpufreq_verify (
struct cpufreq_policy *policy)
{
@@ -1703,7 +1703,7 @@
ACPI_FUNCTION_TRACE("acpi_cpufreq_verify");
if (!policy)
- return_VOID;
+ return_VALUE(-EINVAL);
/* get a present, initialized CPU */
if (policy->cpu == CPUFREQ_ALL_CPUS)
@@ -1721,7 +1721,7 @@
cpu = policy->cpu;
pr = processors[cpu];
if (!pr)
- return_VOID;
+ return_VALUE(-EINVAL);
}
/* first check if min and max are within valid limits */
@@ -1741,13 +1741,12 @@
next_larger_state = i;
}
- if (number_states)
- return_VOID;
-
- /* round up now */
- policy->max = pr->performance.states[next_larger_state].core_frequency * 1000;
+ if (!number_states) {
+ /* round up now */
+ policy->max = pr->performance.states[next_larger_state].core_frequency * 1000;
+ }
- return_VOID;
+ return_VALUE(0);
}
static int
diff -ruN linux-2545original/arch/arm/mach-integrator/cpu.c linux/arch/arm/mach-integrator/cpu.c
--- linux-2545original/arch/arm/mach-integrator/cpu.c Thu Oct 31 12:00:00 2002
+++ linux/arch/arm/mach-integrator/cpu.c Thu Oct 31 23:00:00 2002
@@ -73,7 +73,7 @@
* Validate the speed in khz. If it is outside our
* range, then return the lowest.
*/
-static void integrator_verify_speed(struct cpufreq_policy *policy)
+static int integrator_verify_speed(struct cpufreq_policy *policy)
{
struct vco vco;
@@ -93,6 +93,8 @@
vco.vdw = 152;
policy->min = policy->max = vco_to_freq(vco, 1);
+
+ return 0;
}
static void do_set_policy(int cpu, struct cpufreq_policy *policy)
@@ -116,7 +118,7 @@
__raw_writel(0, CM_LOCK);
}
-static void integrator_set_policy(struct cpufreq_policy *policy)
+static int integrator_set_policy(struct cpufreq_policy *policy)
{
unsigned long cpus_allowed;
int cpu;
@@ -139,6 +141,8 @@
* Restore the CPUs allowed mask.
*/
set_cpus_allowed(current, cpus_allowed);
+
+ return 0;
}
static struct cpufreq_policy integrator_policy = {
diff -ruN linux-2545original/arch/arm/mach-sa1100/cpu-sa1100.c linux/arch/arm/mach-sa1100/cpu-sa1100.c
--- linux-2545original/arch/arm/mach-sa1100/cpu-sa1100.c Thu Oct 31 12:00:00 2002
+++ linux/arch/arm/mach-sa1100/cpu-sa1100.c Thu Oct 31 23:00:00 2002
@@ -176,7 +176,7 @@
}
}
-static void sa1100_setspeed(struct cpufreq_policy *policy)
+static int sa1100_setspeed(struct cpufreq_policy *policy)
{
unsigned int cur = sa11x0_getspeed();
struct cpufreq_freqs freqs;
@@ -196,6 +196,8 @@
sa1100_update_dram_timings(cur, policy->max);
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
+
+ return 0;
}
static struct cpufreq_policy sa1100_policy = {
@@ -216,7 +218,7 @@
int ret = -ENODEV;
if ((processor_id & CPU_SA1100_MASK) == CPU_SA1100_ID) {
- sa1100_driver.cpu_curr_freq[0] =
+ sa1100_driver.cpu_cur_freq[0] =
sa1100_policy.min =
sa1100_policy.max = sa11x0_getspeed();
diff -ruN linux-2545original/arch/arm/mach-sa1100/cpu-sa1110.c linux/arch/arm/mach-sa1100/cpu-sa1110.c
--- linux-2545original/arch/arm/mach-sa1100/cpu-sa1110.c Thu Oct 31 12:00:00 2002
+++ linux/arch/arm/mach-sa1100/cpu-sa1110.c Thu Oct 31 23:00:00 2002
@@ -212,7 +212,7 @@
* above, we can match for an exact frequency. If we don't find
* an exact match, we will to set the lowest frequency to be safe.
*/
-static void sa1110_setspeed(struct cpufreq_policy *policy)
+static int sa1110_setspeed(struct cpufreq_policy *policy)
{
struct sdram_params *sdram = &sdram_params;
struct cpufreq_freqs freqs;
@@ -291,6 +291,8 @@
sdram_update_refresh(policy->max, sdram);
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
+
+ return 0;
}
static struct cpufreq_policy sa1110_policy = {
diff -ruN linux-2545original/arch/arm/mach-sa1100/generic.c linux/arch/arm/mach-sa1100/generic.c
--- linux-2545original/arch/arm/mach-sa1100/generic.c Thu Oct 31 12:00:00 2002
+++ linux/arch/arm/mach-sa1100/generic.c Thu Oct 31 23:00:00 2002
@@ -67,7 +67,7 @@
* scaling, so we force min=max, and set the policy to "performance".
* If we can't generate the precise frequency requested, round it up.
*/
-void sa11x0_verify_speed(struct cpufreq_policy *policy)
+int sa11x0_verify_speed(struct cpufreq_policy *policy)
{
if (policy->max > policy->max_cpu_freq)
policy->max = policy->max_cpu_freq;
@@ -75,6 +75,7 @@
policy->max = cclk_frequency_100khz[sa11x0_freq_to_ppcr(policy->max)] * 100;
policy->min = policy->max;
policy->policy = CPUFREQ_POLICY_POWERSAVE;
+ return 0;
}
unsigned int sa11x0_getspeed(void)
diff -ruN linux-2545original/arch/i386/kernel/cpu/cpufreq/elanfreq.c linux/arch/i386/kernel/cpu/cpufreq/elanfreq.c
--- linux-2545original/arch/i386/kernel/cpu/cpufreq/elanfreq.c Thu Oct 31 12:00:00 2002
+++ linux/arch/i386/kernel/cpu/cpufreq/elanfreq.c Thu Oct 31 23:00:00 2002
@@ -172,13 +172,13 @@
* for the hardware supported by the driver.
*/
-static void elanfreq_verify (struct cpufreq_policy *policy)
+static int elanfreq_verify (struct cpufreq_policy *policy)
{
unsigned int number_states = 0;
unsigned int i;
if (!policy || !max_freq)
- return;
+ return -EINVAL;
policy->cpu = 0;
@@ -190,7 +190,7 @@
number_states++;
if (number_states)
- return;
+ return 0;
for (i=(sizeof(elan_multiplier)/sizeof(struct s_elan_multiplier) - 1); i>=0; i--)
if (elan_multiplier[i].clock < policy->max)
@@ -198,16 +198,16 @@
policy->max = elan_multiplier[i+1].clock;
- return;
+ return 0;
}
-static void elanfreq_setpolicy (struct cpufreq_policy *policy)
+static int elanfreq_setpolicy (struct cpufreq_policy *policy)
{
unsigned int number_states = 0;
unsigned int i, j=4;
if (!elanfreq_driver)
- return;
+ return -EINVAL;
for (i=(sizeof(elan_multiplier)/sizeof(struct s_elan_multiplier) - 1); i>=0; i--)
if ((elan_multiplier[i].clock >= policy->min) &&
@@ -219,7 +219,7 @@
if (number_states == 1) {
elanfreq_set_cpu_state(j);
- return;
+ return 0;
}
switch (policy->policy) {
@@ -236,14 +236,14 @@
j = i;
break;
default:
- return;
+ return -EINVAL;
}
if (elan_multiplier[j].clock > max_freq)
- BUG();
+ return -EINVAL;
elanfreq_set_cpu_state(j);
- return;
+ return 0;
}
@@ -309,15 +309,15 @@
driver->policy[0].policy = CPUFREQ_POLICY_PERFORMANCE;
driver->policy[0].max_cpu_freq = max_freq;
+ elanfreq_driver = driver;
+
ret = cpufreq_register(driver);
if (ret) {
+ elanfreq_driver = NULL;
kfree(driver);
- return ret;
}
- elanfreq_driver = driver;
-
- return 0;
+ return ret;
}
diff -ruN linux-2545original/arch/i386/kernel/cpu/cpufreq/longhaul.c linux/arch/i386/kernel/cpu/cpufreq/longhaul.c
--- linux-2545original/arch/i386/kernel/cpu/cpufreq/longhaul.c Thu Oct 31 12:00:00 2002
+++ linux/arch/i386/kernel/cpu/cpufreq/longhaul.c Thu Oct 31 23:00:00 2002
@@ -531,7 +531,7 @@
}
-static void longhaul_verify(struct cpufreq_policy *policy)
+static int longhaul_verify(struct cpufreq_policy *policy)
{
unsigned int number_states = 0;
unsigned int i;
@@ -540,7 +540,7 @@
unsigned int newmax = -1;
if (!policy || !longhaul_driver)
- return;
+ return -EINVAL;
policy->cpu = 0;
cpufreq_verify_within_limits(policy, lowest_speed, highest_speed);
@@ -552,7 +552,7 @@
number_states = longhaul_statecount_fsb(policy, current_fsb);
if (number_states)
- return;
+ return 0;
/* get frequency closest above current policy->max */
if (can_scale_fsb==1) {
@@ -579,10 +579,12 @@
}
policy->max = newmax;
+
+ return 0;
}
-static void longhaul_setpolicy (struct cpufreq_policy *policy)
+static int longhaul_setpolicy (struct cpufreq_policy *policy)
{
unsigned int number_states = 0;
unsigned int i;
@@ -592,7 +594,7 @@
unsigned int best_freq = -1;
if (!longhaul_driver)
- return;
+ return -EINVAL;
if (policy->policy==CPUFREQ_POLICY_PERFORMANCE)
fsb_search_table = perf_fsb_table;
@@ -613,7 +615,7 @@
}
if (!number_states)
- return;
+ return -EINVAL;
else if (number_states == 1) {
for(i=0; i<numscales; i++) {
if ((clock_ratio[i] != -1) &&
@@ -692,11 +694,11 @@
}
break;
default:
- return;
+ return -EINVAL;
}
longhaul_setstate(new_clock_ratio, new_fsb);
- return;
+ return 0;
}
@@ -788,15 +790,15 @@
driver->policy[0].policy = CPUFREQ_POLICY_PERFORMANCE;
driver->policy[0].max_cpu_freq = (unsigned int) highest_speed;
- ret = cpufreq_register(driver);
+ longhaul_driver = driver;
+ ret = cpufreq_register(driver);
if (ret) {
+ longhaul_driver = NULL;
kfree(driver);
- return ret;
}
- longhaul_driver = driver;
- return 0;
+ return ret;
}
diff -ruN linux-2545original/arch/i386/kernel/cpu/cpufreq/longrun.c linux/arch/i386/kernel/cpu/cpufreq/longrun.c
--- linux-2545original/arch/i386/kernel/cpu/cpufreq/longrun.c Thu Oct 31 12:00:00 2002
+++ linux/arch/i386/kernel/cpu/cpufreq/longrun.c Thu Oct 31 23:00:00 2002
@@ -67,13 +67,13 @@
* Sets a new CPUFreq policy on LongRun-capable processors. This function
* has to be called with cpufreq_driver locked.
*/
-static void longrun_set_policy(struct cpufreq_policy *policy)
+static int longrun_set_policy(struct cpufreq_policy *policy)
{
u32 msr_lo, msr_hi;
u32 pctg_lo, pctg_hi;
if (!longrun_driver || !policy)
- return;
+ return -EINVAL;
pctg_lo = (policy->min - longrun_low_freq) /
((longrun_high_freq - longrun_low_freq) / 100);
@@ -105,7 +105,7 @@
msr_hi |= pctg_hi;
wrmsr(MSR_TMTA_LONGRUN_CTRL, msr_lo, msr_hi);
- return;
+ return 0;
}
@@ -115,16 +115,16 @@
* Validates a new CPUFreq policy. This function has to be called with
* cpufreq_driver locked.
*/
-static void longrun_verify_policy(struct cpufreq_policy *policy)
+static int longrun_verify_policy(struct cpufreq_policy *policy)
{
if (!policy || !longrun_driver)
- return;
+ return -EINVAL;
policy->cpu = 0;
cpufreq_verify_within_limits(policy, 0,
longrun_driver->policy[0].max_cpu_freq);
- return;
+ return 0;
}
@@ -258,14 +258,16 @@
driver->verify = &longrun_verify_policy;
driver->setpolicy = &longrun_set_policy;
+
+ longrun_driver = driver;
+
result = cpufreq_register(driver);
if (result) {
+ longrun_driver = NULL;
kfree(driver);
- return result;
}
- longrun_driver = driver;
- return 0;
+ return result;
}
diff -ruN linux-2545original/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c linux/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
--- linux-2545original/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c Thu Oct 31 12:00:00 2002
+++ linux/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c Thu Oct 31 23:00:00 2002
@@ -136,14 +136,14 @@
}
-static void cpufreq_p4_setpolicy(struct cpufreq_policy *policy)
+static int cpufreq_p4_setpolicy(struct cpufreq_policy *policy)
{
unsigned int i;
unsigned int newstate = 0;
unsigned int number_states = 0;
if (!cpufreq_p4_driver || !stock_freq || !policy)
- return;
+ return -EINVAL;
if (policy->policy == CPUFREQ_POLICY_POWERSAVE)
{
@@ -183,16 +183,17 @@
min_state = newstate - (number_states - 1);
}
} */
+ return 0;
}
-static void cpufreq_p4_verify(struct cpufreq_policy *policy)
+static int cpufreq_p4_verify(struct cpufreq_policy *policy)
{
unsigned int number_states = 0;
unsigned int i;
if (!cpufreq_p4_driver || !stock_freq || !policy)
- return;
+ return -EINVAL;
if (!cpu_online(policy->cpu))
policy->cpu = CPUFREQ_ALL_CPUS;
@@ -205,10 +206,10 @@
number_states++;
if (number_states)
- return;
+ return 0;
policy->max = (stock_freq / 8) * (((unsigned int) ((policy->max * 8) / stock_freq)) + 1);
- return;
+ return 0;
}
@@ -274,15 +275,15 @@
driver->policy[i].cpu = i;
}
+ cpufreq_p4_driver = driver;
+
ret = cpufreq_register(driver);
if (ret) {
+ cpufreq_p4_driver = NULL;
kfree(driver);
- return ret;
}
- cpufreq_p4_driver = driver;
-
- return 0;
+ return ret;
}
diff -ruN linux-2545original/arch/i386/kernel/cpu/cpufreq/powernow-k6.c linux/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
--- linux-2545original/arch/i386/kernel/cpu/cpufreq/powernow-k6.c Thu Oct 31 12:00:00 2002
+++ linux/arch/i386/kernel/cpu/cpufreq/powernow-k6.c Thu Oct 31 23:00:00 2002
@@ -113,13 +113,13 @@
* Policy must be within lowest and highest possible CPU Frequency,
* and at least one possible state must be within min and max.
*/
-static void powernow_k6_verify(struct cpufreq_policy *policy)
+static int powernow_k6_verify(struct cpufreq_policy *policy)
{
unsigned int number_states = 0;
unsigned int i, j;
if (!policy || !busfreq)
- return;
+ return -EINVAL;
policy->cpu = 0;
cpufreq_verify_within_limits(policy, (20 * busfreq),
@@ -131,7 +131,7 @@
number_states++;
if (number_states)
- return;
+ return 0;
/* no state is available within range -- find next larger state */
@@ -144,7 +144,7 @@
policy->max = clock_ratio[j] * busfreq;
- return;
+ return 0;
}
@@ -154,13 +154,13 @@
*
* sets a new CPUFreq policy
*/
-static void powernow_k6_setpolicy (struct cpufreq_policy *policy)
+static int powernow_k6_setpolicy (struct cpufreq_policy *policy)
{
unsigned int number_states = 0;
unsigned int i, j=4;
if (!powernow_driver)
- return;
+ return -EINVAL;
for (i=0; i<8; i++)
if ((policy->min <= (busfreq * clock_ratio[i])) &&
@@ -174,7 +174,7 @@
/* if only one state is within the limit borders, it
is easily detected and set */
powernow_k6_set_state(j);
- return;
+ return 0;
}
/* more than one state within limit */
@@ -196,14 +196,14 @@
j = i;
break;
default:
- return;
+ return -EINVAL;
}
if (clock_ratio[i] > max_multiplier)
- BUG();
+ return -EINVAL;
powernow_k6_set_state(j);
- return;
+ return 0;
}
@@ -255,16 +255,16 @@
driver->policy[0].policy = CPUFREQ_POLICY_PERFORMANCE;
driver->policy[0].max_cpu_freq = busfreq * max_multiplier;
+ powernow_driver = driver;
result = cpufreq_register(driver);
if (result) {
release_region (POWERNOW_IOPORT, 16);
+ powernow_driver = NULL;
kfree(driver);
- return result;
}
- powernow_driver = driver;
- return 0;
+ return result;
}
diff -ruN linux-2545original/arch/i386/kernel/cpu/cpufreq/speedstep.c linux/arch/i386/kernel/cpu/cpufreq/speedstep.c
--- linux-2545original/arch/i386/kernel/cpu/cpufreq/speedstep.c Thu Oct 31 12:00:00 2002
+++ linux/arch/i386/kernel/cpu/cpufreq/speedstep.c Thu Oct 31 23:00:00 2002
@@ -567,10 +567,10 @@
*
* Sets a new CPUFreq policy.
*/
-static void speedstep_setpolicy (struct cpufreq_policy *policy)
+static int speedstep_setpolicy (struct cpufreq_policy *policy)
{
if (!speedstep_driver || !policy)
- return;
+ return -EINVAL;
if (policy->min > speedstep_low_freq)
speedstep_set_state(SPEEDSTEP_HIGH, 1);
@@ -585,6 +585,7 @@
speedstep_set_state(SPEEDSTEP_HIGH, 1);
}
}
+ return 0;
}
@@ -595,11 +596,11 @@
* Limit must be within speedstep_low_freq and speedstep_high_freq, with
* at least one border included.
*/
-static void speedstep_verify (struct cpufreq_policy *policy)
+static int speedstep_verify (struct cpufreq_policy *policy)
{
if (!policy || !speedstep_driver ||
!speedstep_low_freq || !speedstep_high_freq)
- return;
+ return -EINVAL;
policy->cpu = 0; /* UP only */
@@ -609,7 +610,7 @@
(policy->max < speedstep_high_freq))
policy->max = speedstep_high_freq;
- return;
+ return 0;
}
@@ -707,14 +708,15 @@
driver->policy[0].policy = (speed == speedstep_low_freq) ?
CPUFREQ_POLICY_POWERSAVE : CPUFREQ_POLICY_PERFORMANCE;
+ speedstep_driver = driver;
+
result = cpufreq_register(driver);
if (result) {
+ speedstep_driver = NULL;
kfree(driver);
- return result;
}
- speedstep_driver = driver;
- return 0;
+ return result;
}