[PATCH] rapidio: make rio_bus_type const

From: Ricardo B. Marliere
Date: Thu Feb 08 2024 - 14:12:07 EST


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

Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Suggested-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Ricardo B. Marliere <ricardo@xxxxxxxxxxxx>
---
drivers/rapidio/rio-driver.c | 2 +-
include/linux/rio.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c
index 1b3b4c2e015d..2baef45ee5ff 100644
--- a/drivers/rapidio/rio-driver.c
+++ b/drivers/rapidio/rio-driver.c
@@ -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,
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 2cd637268b4f..e9ca2fb7133f 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -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;

---
base-commit: 547ab8fc4cb04a1a6b34377dd8fad34cd2c8a8e3
change-id: 20240208-bus_cleanup-rapidio-93b380dbbea5

Best regards,
--
Ricardo B. Marliere <ricardo@xxxxxxxxxxxx>