* [PATCH] drivers: mhi: make mhi_ep_bus_type const
@ 2025-09-19 7:44 Adrian Barnaś
2025-09-19 15:39 ` Greg Kroah-Hartman
2025-10-15 11:24 ` Manivannan Sadhasivam
0 siblings, 2 replies; 3+ messages in thread
From: Adrian Barnaś @ 2025-09-19 7:44 UTC (permalink / raw)
To: Manivannan Sadhasivam, mhi, linux-arm-msm, linux-kernel
Cc: Akhil Vinod, Sumit Kumar, Krishna Chaitanya Chundru,
Greg Kroah-Hartman, 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.
Signed-off-by: Adrian Barnaś <abarnas@google.com>
---
drivers/bus/mhi/ep/internal.h | 2 +-
drivers/bus/mhi/ep/main.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/mhi/ep/internal.h b/drivers/bus/mhi/ep/internal.h
index 577965f95fda..512da7482acc 100644
--- a/drivers/bus/mhi/ep/internal.h
+++ b/drivers/bus/mhi/ep/internal.h
@@ -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
diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
index cdea24e92919..86e003bc44e0 100644
--- a/drivers/bus/mhi/ep/main.c
+++ b/drivers/bus/mhi/ep/main.c
@@ -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,
--
2.51.0.534.gc79095c0ca-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drivers: mhi: make mhi_ep_bus_type const
2025-09-19 7:44 [PATCH] drivers: mhi: make mhi_ep_bus_type const Adrian Barnaś
@ 2025-09-19 15:39 ` Greg Kroah-Hartman
2025-10-15 11:24 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2025-09-19 15:39 UTC (permalink / raw)
To: Adrian Barnaś
Cc: Manivannan Sadhasivam, mhi, linux-arm-msm, linux-kernel,
Akhil Vinod, Sumit Kumar, Krishna Chaitanya Chundru
On Fri, Sep 19, 2025 at 07:44:08AM +0000, Adrian Barnaś wrote:
> 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.
>
> Signed-off-by: Adrian Barnaś <abarnas@google.com>
> ---
> drivers/bus/mhi/ep/internal.h | 2 +-
> drivers/bus/mhi/ep/main.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers: mhi: make mhi_ep_bus_type const
2025-09-19 7:44 [PATCH] drivers: mhi: make mhi_ep_bus_type const Adrian Barnaś
2025-09-19 15:39 ` Greg Kroah-Hartman
@ 2025-10-15 11:24 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2025-10-15 11:24 UTC (permalink / raw)
To: Adrian Barnaś
Cc: mhi, linux-arm-msm, linux-kernel, Akhil Vinod, Sumit Kumar,
Krishna Chaitanya Chundru, Greg Kroah-Hartman
On Fri, Sep 19, 2025 at 07:44:08AM +0000, Adrian Barnaś wrote:
> 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.
>
> Signed-off-by: Adrian Barnaś <abarnas@google.com>
Applied to mhi-next!
- Mani
> ---
> drivers/bus/mhi/ep/internal.h | 2 +-
> drivers/bus/mhi/ep/main.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bus/mhi/ep/internal.h b/drivers/bus/mhi/ep/internal.h
> index 577965f95fda..512da7482acc 100644
> --- a/drivers/bus/mhi/ep/internal.h
> +++ b/drivers/bus/mhi/ep/internal.h
> @@ -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
> diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
> index cdea24e92919..86e003bc44e0 100644
> --- a/drivers/bus/mhi/ep/main.c
> +++ b/drivers/bus/mhi/ep/main.c
> @@ -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,
> --
> 2.51.0.534.gc79095c0ca-goog
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-15 11:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19 7:44 [PATCH] drivers: mhi: make mhi_ep_bus_type const Adrian Barnaś
2025-09-19 15:39 ` Greg Kroah-Hartman
2025-10-15 11:24 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox