Skip to content

Commit 09681a0

Browse files
Sebastian Andrzej Siewiorrafaeljw
authored andcommitted
cpufreq: Replace deprecated CPU-hotplug functions
The functions get_online_cpus() and put_online_cpus() have been deprecated during the CPU hotplug rework. They map directly to cpus_read_lock() and cpus_read_unlock(). Replace deprecated CPU-hotplug functions with the official version. The behavior remains unchanged. Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent c500bee commit 09681a0

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
163163
if (ret || val > 1)
164164
return -EINVAL;
165165

166-
get_online_cpus();
166+
cpus_read_lock();
167167
set_boost(policy, val);
168-
put_online_cpus();
168+
cpus_read_unlock();
169169

170170
return count;
171171
}

drivers/cpufreq/cpufreq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,18 +2654,18 @@ int cpufreq_boost_trigger_state(int state)
26542654
cpufreq_driver->boost_enabled = state;
26552655
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
26562656

2657-
get_online_cpus();
2657+
cpus_read_lock();
26582658
for_each_active_policy(policy) {
26592659
ret = cpufreq_driver->set_boost(policy, state);
26602660
if (ret)
26612661
goto err_reset_state;
26622662
}
2663-
put_online_cpus();
2663+
cpus_read_unlock();
26642664

26652665
return 0;
26662666

26672667
err_reset_state:
2668-
put_online_cpus();
2668+
cpus_read_unlock();
26692669

26702670
write_lock_irqsave(&cpufreq_driver_lock, flags);
26712671
cpufreq_driver->boost_enabled = !state;

drivers/cpufreq/cpufreq_ondemand.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ static void od_set_powersave_bias(unsigned int powersave_bias)
418418
default_powersave_bias = powersave_bias;
419419
cpumask_clear(&done);
420420

421-
get_online_cpus();
421+
cpus_read_lock();
422422
for_each_online_cpu(cpu) {
423423
struct cpufreq_policy *policy;
424424
struct policy_dbs_info *policy_dbs;
@@ -442,7 +442,7 @@ static void od_set_powersave_bias(unsigned int powersave_bias)
442442
od_tuners = dbs_data->tuners;
443443
od_tuners->powersave_bias = default_powersave_bias;
444444
}
445-
put_online_cpus();
445+
cpus_read_unlock();
446446
}
447447

448448
void od_register_powersave_bias_handler(unsigned int (*f)

drivers/cpufreq/intel_pstate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2969,7 +2969,7 @@ static void intel_pstate_driver_cleanup(void)
29692969
{
29702970
unsigned int cpu;
29712971

2972-
get_online_cpus();
2972+
cpus_read_lock();
29732973
for_each_online_cpu(cpu) {
29742974
if (all_cpu_data[cpu]) {
29752975
if (intel_pstate_driver == &intel_pstate)
@@ -2979,7 +2979,7 @@ static void intel_pstate_driver_cleanup(void)
29792979
all_cpu_data[cpu] = NULL;
29802980
}
29812981
}
2982-
put_online_cpus();
2982+
cpus_read_unlock();
29832983

29842984
intel_pstate_driver = NULL;
29852985
}

drivers/cpufreq/powernow-k8.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,18 +1180,18 @@ static int powernowk8_init(void)
11801180
if (!x86_match_cpu(powernow_k8_ids))
11811181
return -ENODEV;
11821182

1183-
get_online_cpus();
1183+
cpus_read_lock();
11841184
for_each_online_cpu(i) {
11851185
smp_call_function_single(i, check_supported_cpu, &ret, 1);
11861186
if (!ret)
11871187
supported_cpus++;
11881188
}
11891189

11901190
if (supported_cpus != num_online_cpus()) {
1191-
put_online_cpus();
1191+
cpus_read_unlock();
11921192
return -ENODEV;
11931193
}
1194-
put_online_cpus();
1194+
cpus_read_unlock();
11951195

11961196
ret = cpufreq_register_driver(&cpufreq_amd64_driver);
11971197
if (ret)

drivers/cpufreq/powernv-cpufreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ static void powernv_cpufreq_work_fn(struct work_struct *work)
918918
unsigned int cpu;
919919
cpumask_t mask;
920920

921-
get_online_cpus();
921+
cpus_read_lock();
922922
cpumask_and(&mask, &chip->mask, cpu_online_mask);
923923
smp_call_function_any(&mask,
924924
powernv_cpufreq_throttle_check, NULL, 0);
@@ -939,7 +939,7 @@ static void powernv_cpufreq_work_fn(struct work_struct *work)
939939
cpufreq_cpu_put(policy);
940940
}
941941
out:
942-
put_online_cpus();
942+
cpus_read_unlock();
943943
}
944944

945945
static int powernv_cpufreq_occ_msg(struct notifier_block *nb,

0 commit comments

Comments
 (0)