]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
driver core: cpu: make cpu_subsys const
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2024 10:26:48 +0000 (11:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Jan 2024 23:57:50 +0000 (15:57 -0800)
Now that the driver core can properly handle constant struct bus_type,
move the cpu_subsys variable to be a constant structure as well, placing
it into read-only memory which can not be modified at runtime.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Link: https://lore.kernel.org/r/2024010548-crane-snooze-a871@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/cpu.c
include/linux/cpu.h

index 47de0f140ba65e0b9cfbff8574a8adeec69e471d..ac84854c85d7b96ccef3d2c9d5ab9919fd355981 100644 (file)
@@ -366,7 +366,7 @@ static int cpu_uevent(const struct device *dev, struct kobj_uevent_env *env)
 }
 #endif
 
-struct bus_type cpu_subsys = {
+const struct bus_type cpu_subsys = {
        .name = "cpu",
        .dev_name = "cpu",
        .match = cpu_subsys_match,
index dcb89c9871640f0a92c85c5f16d94a8e199c3a23..0b993a1409467adac6bc51519586c59e4e5ef6b8 100644 (file)
@@ -128,7 +128,7 @@ static inline void cpu_maps_update_done(void)
 static inline int add_cpu(unsigned int cpu) { return 0;}
 
 #endif /* CONFIG_SMP */
-extern struct bus_type cpu_subsys;
+extern const struct bus_type cpu_subsys;
 
 extern int lockdep_is_cpus_held(void);