Commit 68b7d00f authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[CPUFREQ] updated cpufreq ref-counting and locking scheme

This patch takes use of the now-working cpufreq_interface.kset and
cpufreq_policy.kobj to use reference counting within the cpufreq core
wherever this is more appropriate than the previous approach -- using one
semaphore. Additionally, the callbacks to the driver modules are protected
now.
parent 4efee5ca
...@@ -619,6 +619,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = { ...@@ -619,6 +619,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
.init = acpi_cpufreq_cpu_init, .init = acpi_cpufreq_cpu_init,
.exit = acpi_cpufreq_cpu_exit, .exit = acpi_cpufreq_cpu_exit,
.name = "acpi-cpufreq", .name = "acpi-cpufreq",
.owner = THIS_MODULE,
}; };
......
...@@ -250,6 +250,7 @@ static struct cpufreq_driver elanfreq_driver = { ...@@ -250,6 +250,7 @@ static struct cpufreq_driver elanfreq_driver = {
.target = elanfreq_target, .target = elanfreq_target,
.init = elanfreq_cpu_init, .init = elanfreq_cpu_init,
.name = "elanfreq", .name = "elanfreq",
.owner = THIS_MODULE,
}; };
......
...@@ -451,6 +451,7 @@ static struct cpufreq_driver gx_suspmod_driver = { ...@@ -451,6 +451,7 @@ static struct cpufreq_driver gx_suspmod_driver = {
.target = cpufreq_gx_target, .target = cpufreq_gx_target,
.init = cpufreq_gx_cpu_init, .init = cpufreq_gx_cpu_init,
.name = "gx-suspmod", .name = "gx-suspmod",
.owner = THIS_MODULE,
}; };
static int __init cpufreq_gx_init(void) static int __init cpufreq_gx_init(void)
......
...@@ -649,6 +649,7 @@ static struct cpufreq_driver longhaul_driver = { ...@@ -649,6 +649,7 @@ static struct cpufreq_driver longhaul_driver = {
.target = longhaul_target, .target = longhaul_target,
.init = longhaul_cpu_init, .init = longhaul_cpu_init,
.name = "longhaul", .name = "longhaul",
.owner = THIS_MODULE,
}; };
static int __init longhaul_init (void) static int __init longhaul_init (void)
......
...@@ -253,6 +253,7 @@ static struct cpufreq_driver longrun_driver = { ...@@ -253,6 +253,7 @@ static struct cpufreq_driver longrun_driver = {
.setpolicy = longrun_set_policy, .setpolicy = longrun_set_policy,
.init = longrun_cpu_init, .init = longrun_cpu_init,
.name = "longrun", .name = "longrun",
.owner = THIS_MODULE,
}; };
......
...@@ -236,6 +236,7 @@ static struct cpufreq_driver p4clockmod_driver = { ...@@ -236,6 +236,7 @@ static struct cpufreq_driver p4clockmod_driver = {
.init = cpufreq_p4_cpu_init, .init = cpufreq_p4_cpu_init,
.exit = cpufreq_p4_cpu_exit, .exit = cpufreq_p4_cpu_exit,
.name = "p4-clockmod", .name = "p4-clockmod",
.owner = THIS_MODULE,
}; };
......
...@@ -190,6 +190,7 @@ static struct cpufreq_driver powernow_k6_driver = { ...@@ -190,6 +190,7 @@ static struct cpufreq_driver powernow_k6_driver = {
.init = powernow_k6_cpu_init, .init = powernow_k6_cpu_init,
.exit = powernow_k6_cpu_exit, .exit = powernow_k6_cpu_exit,
.name = "powernow-k6", .name = "powernow-k6",
.owner = THIS_MODULE,
}; };
......
...@@ -377,6 +377,7 @@ static struct cpufreq_driver powernow_driver = { ...@@ -377,6 +377,7 @@ static struct cpufreq_driver powernow_driver = {
.target = powernow_target, .target = powernow_target,
.init = powernow_cpu_init, .init = powernow_cpu_init,
.name = "powernow-k7", .name = "powernow-k7",
.owner = THIS_MODULE,
}; };
static int __init powernow_init (void) static int __init powernow_init (void)
......
...@@ -658,6 +658,7 @@ static struct cpufreq_driver speedstep_driver = { ...@@ -658,6 +658,7 @@ static struct cpufreq_driver speedstep_driver = {
.verify = speedstep_verify, .verify = speedstep_verify,
.target = speedstep_target, .target = speedstep_target,
.init = speedstep_cpu_init, .init = speedstep_cpu_init,
.owner = THIS_MODULE,
}; };
......
...@@ -276,6 +276,7 @@ static int __init us3freq_init(void) ...@@ -276,6 +276,7 @@ static int __init us3freq_init(void)
driver->target = us3freq_target; driver->target = us3freq_target;
driver->init = us3freq_cpu_init; driver->init = us3freq_cpu_init;
driver->exit = us3freq_cpu_exit; driver->exit = us3freq_cpu_exit;
driver->owner = THIS_MODULE,
strcpy(driver->name, "UltraSPARC-III"); strcpy(driver->name, "UltraSPARC-III");
cpufreq_us3_driver = driver; cpufreq_us3_driver = driver;
......
...@@ -113,7 +113,7 @@ int cpufreq_set(unsigned int freq, unsigned int cpu) ...@@ -113,7 +113,7 @@ int cpufreq_set(unsigned int freq, unsigned int cpu)
if (freq > cpu_max_freq[cpu]) if (freq > cpu_max_freq[cpu])
freq = cpu_max_freq[cpu]; freq = cpu_max_freq[cpu];
ret = cpufreq_driver_target_l(&current_policy[cpu], freq, ret = cpufreq_driver_target(&current_policy[cpu], freq,
CPUFREQ_RELATION_L); CPUFREQ_RELATION_L);
err: err:
......
...@@ -70,6 +70,8 @@ struct cpufreq_policy { ...@@ -70,6 +70,8 @@ struct cpufreq_policy {
struct cpufreq_cpuinfo cpuinfo; /* see above */ struct cpufreq_cpuinfo cpuinfo; /* see above */
struct device * dev; struct device * dev;
struct kobject kobj; struct kobject kobj;
struct semaphore lock; /* CPU ->setpolicy or ->target may
only be called once a time */
}; };
#define CPUFREQ_ADJUST (0) #define CPUFREQ_ADJUST (0)
...@@ -132,18 +134,13 @@ struct cpufreq_governor { ...@@ -132,18 +134,13 @@ struct cpufreq_governor {
}; };
/* pass a target to the cpufreq driver /* pass a target to the cpufreq driver
* _l : (cpufreq_driver_sem is not held)
*/ */
inline int cpufreq_driver_target(struct cpufreq_policy *policy, inline int cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation); unsigned int relation);
inline int cpufreq_driver_target_l(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation);
/* pass an event to the cpufreq governor */ /* pass an event to the cpufreq governor */
int cpufreq_governor_l(unsigned int cpu, unsigned int event); int cpufreq_governor(unsigned int cpu, unsigned int event);
int cpufreq_register_governor(struct cpufreq_governor *governor); int cpufreq_register_governor(struct cpufreq_governor *governor);
void cpufreq_unregister_governor(struct cpufreq_governor *governor); void cpufreq_unregister_governor(struct cpufreq_governor *governor);
...@@ -165,6 +162,7 @@ struct cpufreq_driver { ...@@ -165,6 +162,7 @@ struct cpufreq_driver {
int (*target) (struct cpufreq_policy *policy, int (*target) (struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation); unsigned int relation);
struct module *owner;
/* optional, for the moment */ /* optional, for the moment */
int (*init) (struct cpufreq_policy *policy); int (*init) (struct cpufreq_policy *policy);
int (*exit) (struct cpufreq_policy *policy); int (*exit) (struct cpufreq_policy *policy);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment