Skip to contentSkip to conversation

drivers: mhi: make mhi_ep_bus_type const

PATCH Applied Adrian Barnaś 3 participants 3 messages Sep 19, 2025 – Oct 15, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: mhi: make mhi_ep_bus_type const

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

---
 drivers/bus/mhi/ep/internal.h | 2 +-
 drivers/bus/mhi/ep/main.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/bus/mhi/ep/internal.h +1 -1
index 577965f95fda..512da7482acc 100644
@@ -11,7 +11,7 @@
 
 #include "../common.h"
 
-extern struct bus_type mhi_ep_bus_type;
+extern const struct bus_type mhi_ep_bus_type;
 
 #define MHI_REG_OFFSET				0x100
 #define BHI_REG_OFFSET				0x200
drivers/bus/mhi/ep/main.c +1 -1
index cdea24e92919..86e003bc44e0 100644
@@ -1703,7 +1703,7 @@ static int mhi_ep_match(struct device *dev, const struct device_driver *drv)
 	return 0;
 };
 
-struct bus_type mhi_ep_bus_type = {
+const struct bus_type mhi_ep_bus_type = {
 	.name = "mhi_ep",
 	.dev_name = "mhi_ep",
 	.match = mhi_ep_match,
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 mhi_ep_bus_type to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 drivers/bus/mhi/ep/internal.h | 2 +-
 drivers/bus/mhi/ep/main.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
maintainer Applied
#2 lore raw
In reply to Adrian Barnaś
Quoted 5 lines · Adrian Barnaś

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

Applied to mhi-next!

- Mani

Quoted 34 lines
---
 drivers/bus/mhi/ep/internal.h | 2 +-
 drivers/bus/mhi/ep/main.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/bus/mhi/ep/internal.h +1 -1
index 577965f95fda..512da7482acc 100644
@@ -11,7 +11,7 @@
 
 #include "../common.h"
 
-extern struct bus_type mhi_ep_bus_type;
+extern const struct bus_type mhi_ep_bus_type;
 
 #define MHI_REG_OFFSET				0x100
 #define BHI_REG_OFFSET				0x200
drivers/bus/mhi/ep/main.c +1 -1
index cdea24e92919..86e003bc44e0 100644
@@ -1703,7 +1703,7 @@ static int mhi_ep_match(struct device *dev, const struct device_driver *drv)
 	return 0;
 };
 
-struct bus_type mhi_ep_bus_type = {
+const struct bus_type mhi_ep_bus_type = {
 	.name = "mhi_ep",
 	.dev_name = "mhi_ep",
 	.match = mhi_ep_match,
Signature · 1 line
2.51.0.534.gc79095c0ca-goog
Signature · 1 line
மணிவண்ணன் சதாசிவம்