hsi: hsi_core: make hsi_bus_type const

Message ID 20240204-bus_cleanup-hsi-v1-1-f9318131e842@marliere.net
State New
Headers
Series hsi: hsi_core: make hsi_bus_type const |

Commit Message

Ricardo B. Marliere Feb. 4, 2024, 4:32 p.m. UTC
  Now that the driver core can properly handle constant struct bus_type,
move the hsi_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/hsi/hsi_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: fa72d143471d04ce3055d8dad9743b08c19e4060
change-id: 20240204-bus_cleanup-hsi-99a65d337c7c

Best regards,
  

Comments

Greg KH Feb. 5, 2024, 12:49 p.m. UTC | #1
On Sun, Feb 04, 2024 at 01:32:13PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the hsi_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>
  
Sebastian Reichel Feb. 6, 2024, 3:34 p.m. UTC | #2
On Sun, 04 Feb 2024 13:32:13 -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the hsi_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] hsi: hsi_core: make hsi_bus_type const
      commit: a0e35a173a86d93040d0e08f9c38526b6cf6c1d1

Best regards,
  

Patch

diff --git a/drivers/hsi/hsi_core.c b/drivers/hsi/hsi_core.c
index acbf82f755a8..e3beeac8aee5 100644
--- a/drivers/hsi/hsi_core.c
+++ b/drivers/hsi/hsi_core.c
@@ -48,7 +48,7 @@  static int hsi_bus_match(struct device *dev, struct device_driver *driver)
 	return false;
 }
 
-static struct bus_type hsi_bus_type = {
+static const struct bus_type hsi_bus_type = {
 	.name		= "hsi",
 	.dev_groups	= hsi_bus_dev_groups,
 	.match		= hsi_bus_match,