aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <[email protected]>2023-03-13 19:28:49 +0100
committerGreg Kroah-Hartman <[email protected]>2023-03-17 15:29:19 +0100
commitdb281d59e26b9aaccfd2334450099a1bc472bac6 (patch)
tree01dddbb578ffd43254d1249d676dadd2fe10576c /kernel
parentc8e15075b2cb58d0ff08cc8772ce259d1be6b0cd (diff)
cpu/hotplug: move to use bus_get_dev_root()
Direct access to the struct bus_type dev_root pointer is going away soon so replace that with a call to bus_get_dev_root() instead, which is what it is there for. Cc: Thomas Gleixner <[email protected]> Cc: Valentin Schneider <[email protected]> Cc: Phil Auld <[email protected]> Cc: Steven Price <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Vincent Donnefort <[email protected]> Cc: Kuppuswamy Sathyanarayanan <[email protected]> Cc: "Jason A. Donenfeld" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 6c0a92ca6bb5..c59b73d13a3a 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -2569,22 +2569,33 @@ static const struct attribute_group cpuhp_smt_attr_group = {
static int __init cpu_smt_sysfs_init(void)
{
- return sysfs_create_group(&cpu_subsys.dev_root->kobj,
- &cpuhp_smt_attr_group);
+ struct device *dev_root;
+ int ret = -ENODEV;
+
+ dev_root = bus_get_dev_root(&cpu_subsys);
+ if (dev_root) {
+ ret = sysfs_create_group(&dev_root->kobj, &cpuhp_smt_attr_group);
+ put_device(dev_root);
+ }
+ return ret;
}
static int __init cpuhp_sysfs_init(void)
{
+ struct device *dev_root;
int cpu, ret;
ret = cpu_smt_sysfs_init();
if (ret)
return ret;
- ret = sysfs_create_group(&cpu_subsys.dev_root->kobj,
- &cpuhp_cpu_root_attr_group);
- if (ret)
- return ret;
+ dev_root = bus_get_dev_root(&cpu_subsys);
+ if (dev_root) {
+ ret = sysfs_create_group(&dev_root->kobj, &cpuhp_cpu_root_attr_group);
+ put_device(dev_root);
+ if (ret)
+ return ret;
+ }
for_each_possible_cpu(cpu) {
struct device *dev = get_cpu_device(cpu);