[PATCH] mfd: mcp-core: make mcp_bus_type const

Ricardo B. Marliere posted 1 patch 2 years ago
drivers/mfd/mcp-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] mfd: mcp-core: make mcp_bus_type const
Posted by Ricardo B. Marliere 2 years ago
Now that the driver core can properly handle constant struct bus_type,
move the mcp_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@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 drivers/mfd/mcp-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c
index 2fa592c37c6f..16ca23311cab 100644
--- a/drivers/mfd/mcp-core.c
+++ b/drivers/mfd/mcp-core.c
@@ -41,7 +41,7 @@ static void mcp_bus_remove(struct device *dev)
 	drv->remove(mcp);
 }
 
-static struct bus_type mcp_bus_type = {
+static const struct bus_type mcp_bus_type = {
 	.name		= "mcp",
 	.match		= mcp_bus_match,
 	.probe		= mcp_bus_probe,

---
base-commit: 1e0ea9e75ff3f395ad6f85f0be2258ef114a53dc
change-id: 20240204-bus_cleanup-mfd-6ffb8bdbe13c

Best regards,
-- 
Ricardo B. Marliere <ricardo@marliere.net>
Re: (subset) [PATCH] mfd: mcp-core: make mcp_bus_type const
Posted by Lee Jones 2 years ago
On Sun, 04 Feb 2024 17:10:32 -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the mcp_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> 

Applied, thanks!

[1/1] mfd: mcp-core: make mcp_bus_type const
      commit: a940faea35c0bbdc0b2e563cc3b75c1b120e3ae8

--
Lee Jones [李琼斯]

Re: [PATCH] mfd: mcp-core: make mcp_bus_type const
Posted by Greg Kroah-Hartman 2 years ago
On Sun, Feb 04, 2024 at 05:10:32PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the mcp_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@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>