Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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" <rafael@kernel.org>
Link: https://lore.kernel.org/r/2024010548-crane-snooze-a871@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+2 -2
+1 -1
drivers/base/cpu.c
··· 366 366 } 367 367 #endif 368 368 369 - struct bus_type cpu_subsys = { 369 + const struct bus_type cpu_subsys = { 370 370 .name = "cpu", 371 371 .dev_name = "cpu", 372 372 .match = cpu_subsys_match,
+1 -1
include/linux/cpu.h
··· 128 128 static inline int add_cpu(unsigned int cpu) { return 0;} 129 129 130 130 #endif /* CONFIG_SMP */ 131 - extern struct bus_type cpu_subsys; 131 + extern const struct bus_type cpu_subsys; 132 132 133 133 extern int lockdep_is_cpus_held(void); 134 134