diff mbox series

slimbus: core: make slimbus_bus const

Message ID 20240213-bus_cleanup-slimbus-v1-1-34f06d82de6e@marliere.net
State Accepted
Commit ab23f1bffcf690ffae2b0c4bb8b09420299be05c
Headers show
Series slimbus: core: make slimbus_bus const | expand

Commit Message

Ricardo B. Marliere Feb. 13, 2024, 2:40 p.m. UTC
Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the slimbus_bus 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>
---
This patch is based on
https://git.kernel.org/pub/scm/linux/kernel/git/srini/slimbus.git/,
should this tree be listed under "SERIAL LOW-POWER INTER-CHIP MEDIA BUS
(SLIMbus)" in the MAINTAINERS file?
---
 drivers/slimbus/core.c  | 2 +-
 include/linux/slimbus.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


---
base-commit: 04b945e4cf81a12365f8207a4d34dbc81ba17413
change-id: 20240213-bus_cleanup-slimbus-e23b9e976fd2

Best regards,
diff mbox series

Patch

diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index d43873bb5fe6..375218e02e28 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -100,7 +100,7 @@  static int slim_device_uevent(const struct device *dev, struct kobj_uevent_env *
 	return add_uevent_var(env, "MODALIAS=slim:%s", dev_name(&sbdev->dev));
 }
 
-struct bus_type slimbus_bus = {
+const struct bus_type slimbus_bus = {
 	.name		= "slimbus",
 	.match		= slim_device_match,
 	.probe		= slim_device_probe,
diff --git a/include/linux/slimbus.h b/include/linux/slimbus.h
index 12c9719b2a55..3042385b7b40 100644
--- a/include/linux/slimbus.h
+++ b/include/linux/slimbus.h
@@ -10,7 +10,7 @@ 
 #include <linux/completion.h>
 #include <linux/mod_devicetable.h>
 
-extern struct bus_type slimbus_bus;
+extern const struct bus_type slimbus_bus;
 
 /**
  * struct slim_eaddr - Enumeration address for a SLIMbus device