Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175909
b: refs/heads/master
c: f162506
h: refs/heads/master
i:
  175907: 8d157f1
v: v3
  • Loading branch information
Tejun Heo committed Oct 29, 2009
1 parent 08259ea commit 099dcc5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b3e9f672b6cd0f4c2982c1bcc0b3c3fb39d3b0fe
refs/heads/master: f16250669d78a32bdfb27cec4d791e85141e11e2
28 changes: 14 additions & 14 deletions trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ struct acpi_cpufreq_data {
unsigned int cpu_feature;
};

static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data);
static DEFINE_PER_CPU(struct acpi_cpufreq_data *, acfreq_data);

static DEFINE_PER_CPU(struct aperfmperf, old_perf);
static DEFINE_PER_CPU(struct aperfmperf, acfreq_old_perf);

/* acpi_perf_data is a pointer to percpu data. */
static struct acpi_processor_performance *acpi_perf_data;
Expand Down Expand Up @@ -214,14 +214,14 @@ static u32 get_cur_val(const struct cpumask *mask)
if (unlikely(cpumask_empty(mask)))
return 0;

switch (per_cpu(drv_data, cpumask_first(mask))->cpu_feature) {
switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) {
case SYSTEM_INTEL_MSR_CAPABLE:
cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
break;
case SYSTEM_IO_CAPABLE:
cmd.type = SYSTEM_IO_CAPABLE;
perf = per_cpu(drv_data, cpumask_first(mask))->acpi_data;
perf = per_cpu(acfreq_data, cpumask_first(mask))->acpi_data;
cmd.addr.io.port = perf->control_register.address;
cmd.addr.io.bit_width = perf->control_register.bit_width;
break;
Expand Down Expand Up @@ -268,8 +268,8 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy,
if (smp_call_function_single(cpu, read_measured_perf_ctrs, &perf, 1))
return 0;

ratio = calc_aperfmperf_ratio(&per_cpu(old_perf, cpu), &perf);
per_cpu(old_perf, cpu) = perf;
ratio = calc_aperfmperf_ratio(&per_cpu(acfreq_old_perf, cpu), &perf);
per_cpu(acfreq_old_perf, cpu) = perf;

retval = (policy->cpuinfo.max_freq * ratio) >> APERFMPERF_SHIFT;

Expand All @@ -278,7 +278,7 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy,

static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
{
struct acpi_cpufreq_data *data = per_cpu(drv_data, cpu);
struct acpi_cpufreq_data *data = per_cpu(acfreq_data, cpu);
unsigned int freq;
unsigned int cached_freq;

Expand Down Expand Up @@ -322,7 +322,7 @@ static unsigned int check_freqs(const struct cpumask *mask, unsigned int freq,
static int acpi_cpufreq_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int relation)
{
struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu);
struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu);
struct acpi_processor_performance *perf;
struct cpufreq_freqs freqs;
struct drv_cmd cmd;
Expand Down Expand Up @@ -416,7 +416,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,

static int acpi_cpufreq_verify(struct cpufreq_policy *policy)
{
struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu);
struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu);

dprintk("acpi_cpufreq_verify\n");

Expand Down Expand Up @@ -563,7 +563,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
return -ENOMEM;

data->acpi_data = per_cpu_ptr(acpi_perf_data, cpu);
per_cpu(drv_data, cpu) = data;
per_cpu(acfreq_data, cpu) = data;

if (cpu_has(c, X86_FEATURE_CONSTANT_TSC))
acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
Expand Down Expand Up @@ -714,20 +714,20 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
acpi_processor_unregister_performance(perf, cpu);
err_free:
kfree(data);
per_cpu(drv_data, cpu) = NULL;
per_cpu(acfreq_data, cpu) = NULL;

return result;
}

static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
{
struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu);
struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu);

dprintk("acpi_cpufreq_cpu_exit\n");

if (data) {
cpufreq_frequency_table_put_attr(policy->cpu);
per_cpu(drv_data, policy->cpu) = NULL;
per_cpu(acfreq_data, policy->cpu) = NULL;
acpi_processor_unregister_performance(data->acpi_data,
policy->cpu);
kfree(data);
Expand All @@ -738,7 +738,7 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)

static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
{
struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu);
struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu);

dprintk("acpi_cpufreq_resume\n");

Expand Down
16 changes: 8 additions & 8 deletions trunk/drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ static DEFINE_SPINLOCK(cpufreq_driver_lock);
* - Lock should not be held across
* __cpufreq_governor(data, CPUFREQ_GOV_STOP);
*/
static DEFINE_PER_CPU(int, policy_cpu);
static DEFINE_PER_CPU(int, cpufreq_policy_cpu);
static DEFINE_PER_CPU(struct rw_semaphore, cpu_policy_rwsem);

#define lock_policy_rwsem(mode, cpu) \
int lock_policy_rwsem_##mode \
(int cpu) \
{ \
int policy_cpu = per_cpu(policy_cpu, cpu); \
int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); \
BUG_ON(policy_cpu == -1); \
down_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu)); \
if (unlikely(!cpu_online(cpu))) { \
Expand All @@ -90,15 +90,15 @@ EXPORT_SYMBOL_GPL(lock_policy_rwsem_write);

void unlock_policy_rwsem_read(int cpu)
{
int policy_cpu = per_cpu(policy_cpu, cpu);
int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu);
BUG_ON(policy_cpu == -1);
up_read(&per_cpu(cpu_policy_rwsem, policy_cpu));
}
EXPORT_SYMBOL_GPL(unlock_policy_rwsem_read);

void unlock_policy_rwsem_write(int cpu)
{
int policy_cpu = per_cpu(policy_cpu, cpu);
int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu);
BUG_ON(policy_cpu == -1);
up_write(&per_cpu(cpu_policy_rwsem, policy_cpu));
}
Expand Down Expand Up @@ -799,7 +799,7 @@ int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy,

/* Set proper policy_cpu */
unlock_policy_rwsem_write(cpu);
per_cpu(policy_cpu, cpu) = managed_policy->cpu;
per_cpu(cpufreq_policy_cpu, cpu) = managed_policy->cpu;

if (lock_policy_rwsem_write(cpu) < 0) {
/* Should not go through policy unlock path */
Expand Down Expand Up @@ -906,7 +906,7 @@ int cpufreq_add_dev_interface(unsigned int cpu, struct cpufreq_policy *policy,
if (!cpu_online(j))
continue;
per_cpu(cpufreq_cpu_data, j) = policy;
per_cpu(policy_cpu, j) = policy->cpu;
per_cpu(cpufreq_policy_cpu, j) = policy->cpu;
}
spin_unlock_irqrestore(&cpufreq_driver_lock, flags);

Expand Down Expand Up @@ -991,7 +991,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
cpumask_copy(policy->cpus, cpumask_of(cpu));

/* Initially set CPU itself as the policy_cpu */
per_cpu(policy_cpu, cpu) = cpu;
per_cpu(cpufreq_policy_cpu, cpu) = cpu;
ret = (lock_policy_rwsem_write(cpu) < 0);
WARN_ON(ret);

Expand Down Expand Up @@ -1946,7 +1946,7 @@ static int __init cpufreq_core_init(void)
int cpu;

for_each_possible_cpu(cpu) {
per_cpu(policy_cpu, cpu) = -1;
per_cpu(cpufreq_policy_cpu, cpu) = -1;
init_rwsem(&per_cpu(cpu_policy_rwsem, cpu));
}

Expand Down
12 changes: 6 additions & 6 deletions trunk/drivers/cpufreq/freq_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
}
EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target);

static DEFINE_PER_CPU(struct cpufreq_frequency_table *, show_table);
static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table);
/**
* show_available_freqs - show available frequencies for the specified CPU
*/
Expand All @@ -185,10 +185,10 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf)
ssize_t count = 0;
struct cpufreq_frequency_table *table;

if (!per_cpu(show_table, cpu))
if (!per_cpu(cpufreq_show_table, cpu))
return -ENODEV;

table = per_cpu(show_table, cpu);
table = per_cpu(cpufreq_show_table, cpu);

for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
Expand Down Expand Up @@ -217,20 +217,20 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
unsigned int cpu)
{
dprintk("setting show_table for cpu %u to %p\n", cpu, table);
per_cpu(show_table, cpu) = table;
per_cpu(cpufreq_show_table, cpu) = table;
}
EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_attr);

void cpufreq_frequency_table_put_attr(unsigned int cpu)
{
dprintk("clearing show_table for cpu %u\n", cpu);
per_cpu(show_table, cpu) = NULL;
per_cpu(cpufreq_show_table, cpu) = NULL;
}
EXPORT_SYMBOL_GPL(cpufreq_frequency_table_put_attr);

struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu)
{
return per_cpu(show_table, cpu);
return per_cpu(cpufreq_show_table, cpu);
}
EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table);

Expand Down

0 comments on commit 099dcc5

Please sign in to comment.