diff options
| author | Nate Lawson <njl@FreeBSD.org> | 2007-08-20 06:28:26 +0000 |
|---|---|---|
| committer | Nate Lawson <njl@FreeBSD.org> | 2007-08-20 06:28:26 +0000 |
| commit | 62db376af3fc08cb16a6c947d1aa40cc7b559d9c (patch) | |
| tree | f9243025cddb48733af291af99660a4d7c25a4cf | |
| parent | 2145b9d20708cd889bc53f980082bb2e36c758a5 (diff) | |
Notes
| -rw-r--r-- | sys/kern/kern_cpu.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c index 1b631b939a6e2..c72ead6a8cfe5 100644 --- a/sys/kern/kern_cpu.c +++ b/sys/kern/kern_cpu.c @@ -227,7 +227,7 @@ cf_set_method(device_t dev, const struct cf_level *level, int priority) const struct cf_setting *set; struct cf_saved_freq *saved_freq, *curr_freq; struct pcpu *pc; - int cpu_id, error, i; + int error, i; sc = device_get_softc(dev); error = 0; @@ -294,22 +294,17 @@ cf_set_method(device_t dev, const struct cf_level *level, int priority) goto out; } - /* Bind to the target CPU before switching, if necessary. */ - cpu_id = PCPU_GET(cpuid); + /* Bind to the target CPU before switching. */ pc = cpu_get_pcpu(set->dev); - if (cpu_id != pc->pc_cpuid) { - thread_lock(curthread); - sched_bind(curthread, pc->pc_cpuid); - thread_unlock(curthread); - } + thread_lock(curthread); + sched_bind(curthread, pc->pc_cpuid); + thread_unlock(curthread); CF_DEBUG("setting abs freq %d on %s (cpu %d)\n", set->freq, device_get_nameunit(set->dev), PCPU_GET(cpuid)); error = CPUFREQ_DRV_SET(set->dev, set); - if (cpu_id != pc->pc_cpuid) { - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); - } + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); if (error) { goto out; } @@ -323,22 +318,17 @@ cf_set_method(device_t dev, const struct cf_level *level, int priority) goto out; } - /* Bind to the target CPU before switching, if necessary. */ - cpu_id = PCPU_GET(cpuid); + /* Bind to the target CPU before switching. */ pc = cpu_get_pcpu(set->dev); - if (cpu_id != pc->pc_cpuid) { - thread_lock(curthread); - sched_bind(curthread, pc->pc_cpuid); - thread_unlock(curthread); - } + thread_lock(curthread); + sched_bind(curthread, pc->pc_cpuid); + thread_unlock(curthread); CF_DEBUG("setting rel freq %d on %s (cpu %d)\n", set->freq, device_get_nameunit(set->dev), PCPU_GET(cpuid)); error = CPUFREQ_DRV_SET(set->dev, set); - if (cpu_id != pc->pc_cpuid) { - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); - } + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); if (error) { /* XXX Back out any successful setting? */ goto out; |
