slimbus: core: make slimbus_bus const
authorRicardo B. Marliere <ricardo@marliere.net>
Sat, 24 Feb 2024 11:44:03 +0000 (11:44 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Mar 2024 20:21:39 +0000 (20:21 +0000)
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>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240224114403.86230-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/slimbus/core.c
include/linux/slimbus.h

index 01cbd462198107b2eb1de205bb7aa1d933420c93..41e62de1f91f30dc3dd750a6f8ba175275c4c4ba 100644 (file)
@@ -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,
index 12c9719b2a554e67a5abe11105e4e7867b3501f1..3042385b7b40333fd0df12dbbfc55933b0d910f2 100644 (file)
@@ -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