Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19155
b: refs/heads/master
c: 83933af
h: refs/heads/master
i:
  19153: 7248279
  19151: c11b068
v: v3
  • Loading branch information
Arjan van de Ven authored and Dave Jones committed Jan 18, 2006
1 parent 0ba4ed9 commit 9c28e01
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 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: 3fc54d37ab64733448faf0185e19a80f070eb9e3
refs/heads/master: 83933af4720b282f6f6a0b6c05a2a47b4cf08819
37 changes: 19 additions & 18 deletions trunk/drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
policy->cpu = cpu;
policy->cpus = cpumask_of_cpu(cpu);

init_MUTEX_LOCKED(&policy->lock);
mutex_init(&policy->lock);
mutex_lock(&policy->lock);
init_completion(&policy->kobj_unregister);
INIT_WORK(&policy->update, handle_update, (void *)(long)cpu);

Expand Down Expand Up @@ -642,7 +643,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
policy->governor = NULL; /* to assure that the starting sequence is
* run in cpufreq_set_policy */
up(&policy->lock);
mutex_unlock(&policy->lock);

/* set default policy */

Expand Down Expand Up @@ -763,10 +764,10 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
#endif

down(&data->lock);
mutex_lock(&data->lock);
if (cpufreq_driver->target)
__cpufreq_governor(data, CPUFREQ_GOV_STOP);
up(&data->lock);
mutex_unlock(&data->lock);

kobject_unregister(&data->kobj);

Expand Down Expand Up @@ -835,9 +836,9 @@ unsigned int cpufreq_quick_get(unsigned int cpu)
unsigned int ret = 0;

if (policy) {
down(&policy->lock);
mutex_lock(&policy->lock);
ret = policy->cur;
up(&policy->lock);
mutex_unlock(&policy->lock);
cpufreq_cpu_put(policy);
}

Expand All @@ -863,7 +864,7 @@ unsigned int cpufreq_get(unsigned int cpu)
if (!cpufreq_driver->get)
goto out;

down(&policy->lock);
mutex_lock(&policy->lock);

ret = cpufreq_driver->get(cpu);

Expand All @@ -876,7 +877,7 @@ unsigned int cpufreq_get(unsigned int cpu)
}
}

up(&policy->lock);
mutex_unlock(&policy->lock);

out:
cpufreq_cpu_put(policy);
Expand Down Expand Up @@ -1159,11 +1160,11 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
if (!policy)
return -EINVAL;

down(&policy->lock);
mutex_lock(&policy->lock);

ret = __cpufreq_driver_target(policy, target_freq, relation);

up(&policy->lock);
mutex_unlock(&policy->lock);

cpufreq_cpu_put(policy);

Expand Down Expand Up @@ -1200,9 +1201,9 @@ int cpufreq_governor(unsigned int cpu, unsigned int event)
if (!policy)
return -EINVAL;

down(&policy->lock);
mutex_lock(&policy->lock);
ret = __cpufreq_governor(policy, event);
up(&policy->lock);
mutex_unlock(&policy->lock);

cpufreq_cpu_put(policy);

Expand Down Expand Up @@ -1269,9 +1270,9 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
if (!cpu_policy)
return -EINVAL;

down(&cpu_policy->lock);
mutex_lock(&cpu_policy->lock);
memcpy(policy, cpu_policy, sizeof(struct cpufreq_policy));
up(&cpu_policy->lock);
mutex_unlock(&cpu_policy->lock);

cpufreq_cpu_put(cpu_policy);

Expand Down Expand Up @@ -1383,15 +1384,15 @@ int cpufreq_set_policy(struct cpufreq_policy *policy)
return -EINVAL;

/* lock this CPU */
down(&data->lock);
mutex_lock(&data->lock);

ret = __cpufreq_set_policy(data, policy);
data->user_policy.min = data->min;
data->user_policy.max = data->max;
data->user_policy.policy = data->policy;
data->user_policy.governor = data->governor;

up(&data->lock);
mutex_unlock(&data->lock);
cpufreq_cpu_put(data);

return ret;
Expand All @@ -1415,7 +1416,7 @@ int cpufreq_update_policy(unsigned int cpu)
if (!data)
return -ENODEV;

down(&data->lock);
mutex_lock(&data->lock);

dprintk("updating policy for CPU %u\n", cpu);
memcpy(&policy,
Expand All @@ -1428,7 +1429,7 @@ int cpufreq_update_policy(unsigned int cpu)

ret = __cpufreq_set_policy(data, &policy);

up(&data->lock);
mutex_unlock(&data->lock);

cpufreq_cpu_put(data);
return ret;
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/cpufreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#ifndef _LINUX_CPUFREQ_H
#define _LINUX_CPUFREQ_H

#include <linux/mutex.h>
#include <linux/config.h>
#include <linux/notifier.h>
#include <linux/threads.h>
Expand Down Expand Up @@ -82,7 +83,7 @@ struct cpufreq_policy {
unsigned int policy; /* see above */
struct cpufreq_governor *governor; /* see below */

struct semaphore lock; /* CPU ->setpolicy or ->target may
struct mutex lock; /* CPU ->setpolicy or ->target may
only be called once a time */

struct work_struct update; /* if update_policy() needs to be
Expand Down

0 comments on commit 9c28e01

Please sign in to comment.