x86/microcode: Replace deprecated CPU-hotplug functions.
[ Upstream commit 2089f34f8c5b91f7235023ec72e71e3247261ecc ] 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@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20210803141621.780504-9-bigeasy@linutronix.de Stable-dep-of: c0dd9245aa9e ("x86/microcode: Check CPU capabilities after late microcode update correctly") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
2e3bd75f64
commit
3900b7de1d
@@ -55,7 +55,7 @@ LIST_HEAD(microcode_cache);
|
|||||||
* All non cpu-hotplug-callback call sites use:
|
* All non cpu-hotplug-callback call sites use:
|
||||||
*
|
*
|
||||||
* - microcode_mutex to synchronize with each other;
|
* - microcode_mutex to synchronize with each other;
|
||||||
* - get/put_online_cpus() to synchronize with
|
* - cpus_read_lock/unlock() to synchronize with
|
||||||
* the cpu-hotplug-callback call sites.
|
* the cpu-hotplug-callback call sites.
|
||||||
*
|
*
|
||||||
* We guarantee that only a single cpu is being
|
* We guarantee that only a single cpu is being
|
||||||
@@ -431,7 +431,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_online_cpus();
|
cpus_read_lock();
|
||||||
mutex_lock(µcode_mutex);
|
mutex_lock(µcode_mutex);
|
||||||
|
|
||||||
if (do_microcode_update(buf, len) == 0)
|
if (do_microcode_update(buf, len) == 0)
|
||||||
@@ -441,7 +441,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
|
|||||||
perf_check_microcode();
|
perf_check_microcode();
|
||||||
|
|
||||||
mutex_unlock(µcode_mutex);
|
mutex_unlock(µcode_mutex);
|
||||||
put_online_cpus();
|
cpus_read_unlock();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -629,7 +629,7 @@ static ssize_t reload_store(struct device *dev,
|
|||||||
if (val != 1)
|
if (val != 1)
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
get_online_cpus();
|
cpus_read_lock();
|
||||||
|
|
||||||
ret = check_online_cpus();
|
ret = check_online_cpus();
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -644,7 +644,7 @@ static ssize_t reload_store(struct device *dev,
|
|||||||
mutex_unlock(µcode_mutex);
|
mutex_unlock(µcode_mutex);
|
||||||
|
|
||||||
put:
|
put:
|
||||||
put_online_cpus();
|
cpus_read_unlock();
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = size;
|
ret = size;
|
||||||
@@ -853,14 +853,14 @@ int __init microcode_init(void)
|
|||||||
if (IS_ERR(microcode_pdev))
|
if (IS_ERR(microcode_pdev))
|
||||||
return PTR_ERR(microcode_pdev);
|
return PTR_ERR(microcode_pdev);
|
||||||
|
|
||||||
get_online_cpus();
|
cpus_read_lock();
|
||||||
mutex_lock(µcode_mutex);
|
mutex_lock(µcode_mutex);
|
||||||
|
|
||||||
error = subsys_interface_register(&mc_cpu_interface);
|
error = subsys_interface_register(&mc_cpu_interface);
|
||||||
if (!error)
|
if (!error)
|
||||||
perf_check_microcode();
|
perf_check_microcode();
|
||||||
mutex_unlock(µcode_mutex);
|
mutex_unlock(µcode_mutex);
|
||||||
put_online_cpus();
|
cpus_read_unlock();
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_pdev;
|
goto out_pdev;
|
||||||
@@ -892,13 +892,13 @@ int __init microcode_init(void)
|
|||||||
&cpu_root_microcode_group);
|
&cpu_root_microcode_group);
|
||||||
|
|
||||||
out_driver:
|
out_driver:
|
||||||
get_online_cpus();
|
cpus_read_lock();
|
||||||
mutex_lock(µcode_mutex);
|
mutex_lock(µcode_mutex);
|
||||||
|
|
||||||
subsys_interface_unregister(&mc_cpu_interface);
|
subsys_interface_unregister(&mc_cpu_interface);
|
||||||
|
|
||||||
mutex_unlock(µcode_mutex);
|
mutex_unlock(µcode_mutex);
|
||||||
put_online_cpus();
|
cpus_read_unlock();
|
||||||
|
|
||||||
out_pdev:
|
out_pdev:
|
||||||
platform_device_unregister(microcode_pdev);
|
platform_device_unregister(microcode_pdev);
|
||||||
|
Reference in New Issue
Block a user