Skip to contentSkip to conversation

driver core: cpu: make cpu_subsys const

PATCH New Greg Kroah-Hartman 1 participant 1 message Jan 5, 2024

Subsystems (2)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/1 driver core: cpu: make cpu_subsys const

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" <[email protected]>
---
 drivers/base/cpu.c  | 2 +-
 include/linux/cpu.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/base/cpu.c +1 -1
index 82b6a76125f5..c3c15adb7da9 100644
@@ -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,
include/linux/cpu.h +1 -1
index dcb89c987164..0b993a140946 100644
@@ -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);
 
Signature · 1 line
2.43.0