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

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


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

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

x86/mtrr: 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-8-bigeasy@xxxxxxxxxxxxx

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

diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c
index a76694b..2746cac 100644
--- a/arch/x86/kernel/cpu/mtrr/mtrr.c
+++ b/arch/x86/kernel/cpu/mtrr/mtrr.c
@@ -336,7 +336,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
replace = -1;

/* No CPU hotplug when we change MTRR entries */
- get_online_cpus();
+ cpus_read_lock();

/* Search for existing MTRR */
mutex_lock(&mtrr_mutex);
@@ -398,7 +398,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
error = i;
out:
mutex_unlock(&mtrr_mutex);
- put_online_cpus();
+ cpus_read_unlock();
return error;
}

@@ -485,7 +485,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)

max = num_var_ranges;
/* No CPU hotplug when we change MTRR entries */
- get_online_cpus();
+ cpus_read_lock();
mutex_lock(&mtrr_mutex);
if (reg < 0) {
/* Search for existing MTRR */
@@ -520,7 +520,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
error = reg;
out:
mutex_unlock(&mtrr_mutex);
- put_online_cpus();
+ cpus_read_unlock();
return error;
}