Skip to contentSkip to conversation

drivers: eisa: make eisa_bus_type const

PATCH In review Adrian Barnaś 2 participants 2 messages Sep 19, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: eisa: make eisa_bus_type const

Because driver core can properly handle constant struct bus_type, move the eisa_bus_type to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 drivers/eisa/eisa-bus.c | 2 +-
 include/linux/eisa.h    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/eisa/eisa-bus.c +1 -1
index edceea083b98..bd76d599109c 100644
@@ -135,7 +135,7 @@ static int eisa_bus_uevent(const struct device *dev, struct kobj_uevent_env *env
 	return 0;
 }
 
-struct bus_type eisa_bus_type = {
+const struct bus_type eisa_bus_type = {
 	.name  = "eisa",
 	.match = eisa_bus_match,
 	.uevent = eisa_bus_uevent,
include/linux/eisa.h +1 -1
index 21a2ecc1e538..cf55630b595b 100644
@@ -68,7 +68,7 @@ struct eisa_driver {
 /* These external functions are only available when EISA support is enabled. */
 #ifdef CONFIG_EISA
 
-extern struct bus_type eisa_bus_type;
+extern const struct bus_type eisa_bus_type;
 int eisa_driver_register (struct eisa_driver *edrv);
 void eisa_driver_unregister (struct eisa_driver *edrv);
 
Signature · 1 line
2.51.0.534.gc79095c0ca-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Adrian Barnaś

Because driver core can properly handle constant struct bus_type, move the eisa_bus_type to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 drivers/eisa/eisa-bus.c | 2 +-
 include/linux/eisa.h    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)