diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-01-14 10:01:49 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-01-18 16:53:45 -0500 |
commit | 83933af4720b282f6f6a0b6c05a2a47b4cf08819 (patch) | |
tree | 7f78fd9684268cb7b4cecac8b440ab0b1c58a5da /drivers/cpufreq/cpufreq.c | |
parent | 3fc54d37ab64733448faf0185e19a80f070eb9e3 (diff) |
[CPUFREQ] convert remaining cpufreq semaphore to a mutex
This one fell through the automation at first because it initializes the
semaphore to locked, but that's easily remedied
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Dave Jones <davej@redhat.com>
drivers/cpufreq/cpufreq.c | 37 +++++++++++++++++++------------------
include/linux/cpufreq.h | 3 ++-
2 files changed, 21 insertions(+), 19 deletions(-)
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index eb2f19d00e93..0675d9f02e34 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -601,7 +601,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
601 | policy->cpu = cpu; | 601 | policy->cpu = cpu; |
602 | policy->cpus = cpumask_of_cpu(cpu); | 602 | policy->cpus = cpumask_of_cpu(cpu); |
603 | 603 | ||
604 | init_MUTEX_LOCKED(&policy->lock); | 604 | mutex_init(&policy->lock); |
605 | mutex_lock(&policy->lock); | ||
605 | init_completion(&policy->kobj_unregister); | 606 | init_completion(&policy->kobj_unregister); |
606 | INIT_WORK(&policy->update, handle_update, (void *)(long)cpu); | 607 | INIT_WORK(&policy->update, handle_update, (void *)(long)cpu); |
607 | 608 | ||
@@ -642,7 +643,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
642 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 643 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
643 | policy->governor = NULL; /* to assure that the starting sequence is | 644 | policy->governor = NULL; /* to assure that the starting sequence is |
644 | * run in cpufreq_set_policy */ | 645 | * run in cpufreq_set_policy */ |
645 | up(&policy->lock); | 646 | mutex_unlock(&policy->lock); |
646 | 647 | ||
647 | /* set default policy */ | 648 | /* set default policy */ |
648 | 649 | ||
@@ -763,10 +764,10 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
763 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 764 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
764 | #endif | 765 | #endif |
765 | 766 | ||
766 | down(&data->lock); | 767 | mutex_lock(&data->lock); |
767 | if (cpufreq_driver->target) | 768 | if (cpufreq_driver->target) |
768 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); | 769 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); |
769 | up(&data->lock); | 770 | mutex_unlock(&data->lock); |
770 | 771 | ||
771 | kobject_unregister(&data->kobj); | 772 | kobject_unregister(&data->kobj); |
772 | 773 | ||
@@ -835,9 +836,9 @@ unsigned int cpufreq_quick_get(unsigned int cpu) | |||
835 | unsigned int ret = 0; | 836 | unsigned int ret = 0; |
836 | 837 | ||
837 | if (policy) { | 838 | if (policy) { |
838 | down(&policy->lock); | 839 | mutex_lock(&policy->lock); |
839 | ret = policy->cur; | 840 | ret = policy->cur; |
840 | up(&policy->lock); | 841 | mutex_unlock(&policy->lock); |
841 | cpufreq_cpu_put(policy); | 842 | cpufreq_cpu_put(policy); |
842 | } | 843 | } |
843 | 844 | ||
@@ -863,7 +864,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
863 | if (!cpufreq_driver->get) | 864 | if (!cpufreq_driver->get) |
864 | goto out; | 865 | goto out; |
865 | 866 | ||
866 | down(&policy->lock); | 867 | mutex_lock(&policy->lock); |
867 | 868 | ||
868 | ret = cpufreq_driver->get(cpu); | 869 | ret = cpufreq_driver->get(cpu); |
869 | 870 | ||
@@ -876,7 +877,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
876 | } | 877 | } |
877 | } | 878 | } |
878 | 879 | ||
879 | up(&policy->lock); | 880 | mutex_unlock(&policy->lock); |
880 | 881 | ||
881 | out: | 882 | out: |
882 | cpufreq_cpu_put(policy); | 883 | cpufreq_cpu_put(policy); |
@@ -1159,11 +1160,11 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1159 | if (!policy) | 1160 | if (!policy) |
1160 | return -EINVAL; | 1161 | return -EINVAL; |
1161 | 1162 | ||
1162 | down(&policy->lock); | 1163 | mutex_lock(&policy->lock); |
1163 | 1164 | ||
1164 | ret = __cpufreq_driver_target(policy, target_freq, relation); | 1165 | ret = __cpufreq_driver_target(policy, target_freq, relation); |
1165 | 1166 | ||
1166 | up(&policy->lock); | 1167 | mutex_unlock(&policy->lock); |
1167 | 1168 | ||
1168 | cpufreq_cpu_put(policy); | 1169 | cpufreq_cpu_put(policy); |
1169 | 1170 | ||
@@ -1200,9 +1201,9 @@ int cpufreq_governor(unsigned int cpu, unsigned int event) | |||
1200 | if (!policy) | 1201 | if (!policy) |
1201 | return -EINVAL; | 1202 | return -EINVAL; |
1202 | 1203 | ||
1203 | down(&policy->lock); | 1204 | mutex_lock(&policy->lock); |
1204 | ret = __cpufreq_governor(policy, event); | 1205 | ret = __cpufreq_governor(policy, event); |
1205 | up(&policy->lock); | 1206 | mutex_unlock(&policy->lock); |
1206 | 1207 | ||
1207 | cpufreq_cpu_put(policy); | 1208 | cpufreq_cpu_put(policy); |
1208 | 1209 | ||
@@ -1269,9 +1270,9 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu) | |||
1269 | if (!cpu_policy) | 1270 | if (!cpu_policy) |
1270 | return -EINVAL; | 1271 | return -EINVAL; |
1271 | 1272 | ||
1272 | down(&cpu_policy->lock); | 1273 | mutex_lock(&cpu_policy->lock); |
1273 | memcpy(policy, cpu_policy, sizeof(struct cpufreq_policy)); | 1274 | memcpy(policy, cpu_policy, sizeof(struct cpufreq_policy)); |
1274 | up(&cpu_policy->lock); | 1275 | mutex_unlock(&cpu_policy->lock); |
1275 | 1276 | ||
1276 | cpufreq_cpu_put(cpu_policy); | 1277 | cpufreq_cpu_put(cpu_policy); |
1277 | 1278 | ||
@@ -1383,7 +1384,7 @@ int cpufreq_set_policy(struct cpufreq_policy *policy) | |||
1383 | return -EINVAL; | 1384 | return -EINVAL; |
1384 | 1385 | ||
1385 | /* lock this CPU */ | 1386 | /* lock this CPU */ |
1386 | down(&data->lock); | 1387 | mutex_lock(&data->lock); |
1387 | 1388 | ||
1388 | ret = __cpufreq_set_policy(data, policy); | 1389 | ret = __cpufreq_set_policy(data, policy); |
1389 | data->user_policy.min = data->min; | 1390 | data->user_policy.min = data->min; |
@@ -1391,7 +1392,7 @@ int cpufreq_set_policy(struct cpufreq_policy *policy) | |||
1391 | data->user_policy.policy = data->policy; | 1392 | data->user_policy.policy = data->policy; |
1392 | data->user_policy.governor = data->governor; | 1393 | data->user_policy.governor = data->governor; |
1393 | 1394 | ||
1394 | up(&data->lock); | 1395 | mutex_unlock(&data->lock); |
1395 | cpufreq_cpu_put(data); | 1396 | cpufreq_cpu_put(data); |
1396 | 1397 | ||
1397 | return ret; | 1398 | return ret; |
@@ -1415,7 +1416,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1415 | if (!data) | 1416 | if (!data) |
1416 | return -ENODEV; | 1417 | return -ENODEV; |
1417 | 1418 | ||
1418 | down(&data->lock); | 1419 | mutex_lock(&data->lock); |
1419 | 1420 | ||
1420 | dprintk("updating policy for CPU %u\n", cpu); | 1421 | dprintk("updating policy for CPU %u\n", cpu); |
1421 | memcpy(&policy, | 1422 | memcpy(&policy, |
@@ -1428,7 +1429,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1428 | 1429 | ||
1429 | ret = __cpufreq_set_policy(data, &policy); | 1430 | ret = __cpufreq_set_policy(data, &policy); |
1430 | 1431 | ||
1431 | up(&data->lock); | 1432 | mutex_unlock(&data->lock); |
1432 | 1433 | ||
1433 | cpufreq_cpu_put(data); | 1434 | cpufreq_cpu_put(data); |
1434 | return ret; | 1435 | return ret; |