Skip to content

Commit 2bc1906

Browse files
committed
driver core: cpu: don't hand-override the uevent bus_type callback.
Instead of having to change the uevent bus_type callback by hand at runtime, set it at build time based on the build configuration options, making this much simpler to maintain and understand (and allow to make the structure constant.) Cc: "Rafael J. Wysocki" <rafael@kernel.org> Link: https://lore.kernel.org/r/20230210102408.1083177-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9d3fe6a commit 2bc1906

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

drivers/base/cpu.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,6 @@ static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
125125
#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
126126
#endif /* CONFIG_HOTPLUG_CPU */
127127

128-
struct bus_type cpu_subsys = {
129-
.name = "cpu",
130-
.dev_name = "cpu",
131-
.match = cpu_subsys_match,
132-
#ifdef CONFIG_HOTPLUG_CPU
133-
.online = cpu_subsys_online,
134-
.offline = cpu_subsys_offline,
135-
#endif
136-
};
137-
EXPORT_SYMBOL_GPL(cpu_subsys);
138-
139128
#ifdef CONFIG_KEXEC
140129
#include <linux/kexec.h>
141130

@@ -348,6 +337,20 @@ static int cpu_uevent(const struct device *dev, struct kobj_uevent_env *env)
348337
}
349338
#endif
350339

340+
struct bus_type cpu_subsys = {
341+
.name = "cpu",
342+
.dev_name = "cpu",
343+
.match = cpu_subsys_match,
344+
#ifdef CONFIG_HOTPLUG_CPU
345+
.online = cpu_subsys_online,
346+
.offline = cpu_subsys_offline,
347+
#endif
348+
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
349+
.uevent = cpu_uevent,
350+
#endif
351+
};
352+
EXPORT_SYMBOL_GPL(cpu_subsys);
353+
351354
/*
352355
* register_cpu - Setup a sysfs device for a CPU.
353356
* @cpu - cpu->hotpluggable field set to 1 will generate a control file in
@@ -368,9 +371,6 @@ int register_cpu(struct cpu *cpu, int num)
368371
cpu->dev.offline_disabled = !cpu->hotpluggable;
369372
cpu->dev.offline = !cpu_online(num);
370373
cpu->dev.of_node = of_get_cpu_node(num, NULL);
371-
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
372-
cpu->dev.bus->uevent = cpu_uevent;
373-
#endif
374374
cpu->dev.groups = common_cpu_attr_groups;
375375
if (cpu->hotpluggable)
376376
cpu->dev.groups = hotplugable_cpu_attr_groups;

0 commit comments

Comments
 (0)