Skip to content

Commit 0fbd006

Browse files
committed
cpu/hotplug: move to use bus_get_dev_root()
JIRA: https://issues.redhat.com/browse/RHEL-1023 commit db281d5 Author: Greg Kroah-Hartman <[email protected]> Date: Mon Mar 13 19:28:49 2023 +0100 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]> Signed-off-by: Mark Langsdorf <[email protected]>
1 parent 1a3cf6a commit 0fbd006

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

kernel/cpu.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,22 +2521,33 @@ static const struct attribute_group cpuhp_smt_attr_group = {
25212521

25222522
static int __init cpu_smt_sysfs_init(void)
25232523
{
2524-
return sysfs_create_group(&cpu_subsys.dev_root->kobj,
2525-
&cpuhp_smt_attr_group);
2524+
struct device *dev_root;
2525+
int ret = -ENODEV;
2526+
2527+
dev_root = bus_get_dev_root(&cpu_subsys);
2528+
if (dev_root) {
2529+
ret = sysfs_create_group(&dev_root->kobj, &cpuhp_smt_attr_group);
2530+
put_device(dev_root);
2531+
}
2532+
return ret;
25262533
}
25272534

25282535
static int __init cpuhp_sysfs_init(void)
25292536
{
2537+
struct device *dev_root;
25302538
int cpu, ret;
25312539

25322540
ret = cpu_smt_sysfs_init();
25332541
if (ret)
25342542
return ret;
25352543

2536-
ret = sysfs_create_group(&cpu_subsys.dev_root->kobj,
2537-
&cpuhp_cpu_root_attr_group);
2538-
if (ret)
2539-
return ret;
2544+
dev_root = bus_get_dev_root(&cpu_subsys);
2545+
if (dev_root) {
2546+
ret = sysfs_create_group(&dev_root->kobj, &cpuhp_cpu_root_attr_group);
2547+
put_device(dev_root);
2548+
if (ret)
2549+
return ret;
2550+
}
25402551

25412552
for_each_possible_cpu(cpu) {
25422553
struct device *dev = get_cpu_device(cpu);

0 commit comments

Comments
 (0)