All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] driver core: cpu: don't hand-override the uevent bus_type callback.
@ 2023-02-10 10:24 Greg Kroah-Hartman
  2023-02-13 16:08 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-02-10 10:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/cpu.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 8bb623039bb2..182c6122f815 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -125,17 +125,6 @@ static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
 #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
 #endif /* CONFIG_HOTPLUG_CPU */
 
-struct bus_type cpu_subsys = {
-	.name = "cpu",
-	.dev_name = "cpu",
-	.match = cpu_subsys_match,
-#ifdef CONFIG_HOTPLUG_CPU
-	.online = cpu_subsys_online,
-	.offline = cpu_subsys_offline,
-#endif
-};
-EXPORT_SYMBOL_GPL(cpu_subsys);
-
 #ifdef CONFIG_KEXEC
 #include <linux/kexec.h>
 
@@ -348,6 +337,20 @@ static int cpu_uevent(const struct device *dev, struct kobj_uevent_env *env)
 }
 #endif
 
+struct bus_type cpu_subsys = {
+	.name = "cpu",
+	.dev_name = "cpu",
+	.match = cpu_subsys_match,
+#ifdef CONFIG_HOTPLUG_CPU
+	.online = cpu_subsys_online,
+	.offline = cpu_subsys_offline,
+#endif
+#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
+	.uevent = cpu_uevent,
+#endif
+};
+EXPORT_SYMBOL_GPL(cpu_subsys);
+
 /*
  * register_cpu - Setup a sysfs device for a CPU.
  * @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)
 	cpu->dev.offline_disabled = !cpu->hotpluggable;
 	cpu->dev.offline = !cpu_online(num);
 	cpu->dev.of_node = of_get_cpu_node(num, NULL);
-#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
-	cpu->dev.bus->uevent = cpu_uevent;
-#endif
 	cpu->dev.groups = common_cpu_attr_groups;
 	if (cpu->hotpluggable)
 		cpu->dev.groups = hotplugable_cpu_attr_groups;
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] driver core: cpu: don't hand-override the uevent bus_type callback.
  2023-02-10 10:24 [PATCH] driver core: cpu: don't hand-override the uevent bus_type callback Greg Kroah-Hartman
@ 2023-02-13 16:08 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-02-13 16:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki

On Fri, Feb 10, 2023 at 11:24 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> 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>

LGTM:

Acked-by: Rafael J. Wysocki <rafael@kernel.org>

> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/base/cpu.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 8bb623039bb2..182c6122f815 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -125,17 +125,6 @@ static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
>  #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
>  #endif /* CONFIG_HOTPLUG_CPU */
>
> -struct bus_type cpu_subsys = {
> -       .name = "cpu",
> -       .dev_name = "cpu",
> -       .match = cpu_subsys_match,
> -#ifdef CONFIG_HOTPLUG_CPU
> -       .online = cpu_subsys_online,
> -       .offline = cpu_subsys_offline,
> -#endif
> -};
> -EXPORT_SYMBOL_GPL(cpu_subsys);
> -
>  #ifdef CONFIG_KEXEC
>  #include <linux/kexec.h>
>
> @@ -348,6 +337,20 @@ static int cpu_uevent(const struct device *dev, struct kobj_uevent_env *env)
>  }
>  #endif
>
> +struct bus_type cpu_subsys = {
> +       .name = "cpu",
> +       .dev_name = "cpu",
> +       .match = cpu_subsys_match,
> +#ifdef CONFIG_HOTPLUG_CPU
> +       .online = cpu_subsys_online,
> +       .offline = cpu_subsys_offline,
> +#endif
> +#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
> +       .uevent = cpu_uevent,
> +#endif
> +};
> +EXPORT_SYMBOL_GPL(cpu_subsys);
> +
>  /*
>   * register_cpu - Setup a sysfs device for a CPU.
>   * @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)
>         cpu->dev.offline_disabled = !cpu->hotpluggable;
>         cpu->dev.offline = !cpu_online(num);
>         cpu->dev.of_node = of_get_cpu_node(num, NULL);
> -#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
> -       cpu->dev.bus->uevent = cpu_uevent;
> -#endif
>         cpu->dev.groups = common_cpu_attr_groups;
>         if (cpu->hotpluggable)
>                 cpu->dev.groups = hotplugable_cpu_attr_groups;
> --
> 2.39.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-13 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10 10:24 [PATCH] driver core: cpu: don't hand-override the uevent bus_type callback Greg Kroah-Hartman
2023-02-13 16:08 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.