[tip: x86/cleanups] x86/mce/inject: Replace deprecated CPU-hotplug functions.

From: tip-bot2 for Sebastian Andrzej Siewior
Date: Tue Aug 10 2021 - 08:52:14 EST


The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: 8ae9e3f63865bc067c144817da9df025dbb667f2
Gitweb: https://git.kernel.org/tip/8ae9e3f63865bc067c144817da9df025dbb667f2
Author: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
AuthorDate: Tue, 03 Aug 2021 16:15:52 +02:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitterDate: Tue, 10 Aug 2021 14:46:27 +02:00

x86/mce/inject: 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 <bigeasy@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20210803141621.780504-10-bigeasy@xxxxxxxxxxxxx

---
arch/x86/kernel/cpu/mce/inject.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c
index 4e86d97..0bfc140 100644
--- a/arch/x86/kernel/cpu/mce/inject.c
+++ b/arch/x86/kernel/cpu/mce/inject.c
@@ -235,7 +235,7 @@ static void __maybe_unused raise_mce(struct mce *m)
unsigned long start;
int cpu;

- get_online_cpus();
+ cpus_read_lock();
cpumask_copy(mce_inject_cpumask, cpu_online_mask);
cpumask_clear_cpu(get_cpu(), mce_inject_cpumask);
for_each_online_cpu(cpu) {
@@ -269,7 +269,7 @@ static void __maybe_unused raise_mce(struct mce *m)
}
raise_local();
put_cpu();
- put_online_cpus();
+ cpus_read_unlock();
} else {
preempt_disable();
raise_local();
@@ -529,7 +529,7 @@ static void do_inject(void)
cpu = get_nbc_for_node(topology_die_id(cpu));
}

- get_online_cpus();
+ cpus_read_lock();
if (!cpu_online(cpu))
goto err;

@@ -553,7 +553,7 @@ static void do_inject(void)
}

err:
- put_online_cpus();
+ cpus_read_unlock();

}