Skip to contentSkip to conversation

drivers: rapidio: make rio_bus_type const

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: rapidio: make rio_bus_type const

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

---
 drivers/rapidio/rio-driver.c | 2 +-
 include/linux/rio.h          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/rapidio/rio-driver.c +1 -1
index 238250e69005..bcfe0b45b377 100644
@@ -227,7 +227,7 @@ struct class rio_mport_class = {
 };
 EXPORT_SYMBOL_GPL(rio_mport_class);
 
-struct bus_type rio_bus_type = {
+const struct bus_type rio_bus_type = {
 	.name = "rapidio",
 	.match = rio_match_bus,
 	.dev_groups = rio_dev_groups,
include/linux/rio.h +1 -1
index 3c29f40f3c94..2c29f21ba9e5 100644
@@ -78,7 +78,7 @@
 #define RIO_CTAG_RESRVD	0xfffe0000 /* Reserved */
 #define RIO_CTAG_UDEVID	0x0001ffff /* Unique device identifier */
 
-extern struct bus_type rio_bus_type;
+extern const struct bus_type rio_bus_type;
 extern struct class rio_mport_class;
 
 struct rio_mport;
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 rio_bus_type to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 drivers/rapidio/rio-driver.c | 2 +-
 include/linux/rio.h          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)