greybus: make greybus_bus_type const
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2024 10:16:17 +0000 (11:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Mar 2024 14:11:23 +0000 (14:11 +0000)
Now that the driver core can properly handle constant struct bus_type,
move the greybus_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Alex Elder <elder@kernel.org>
Cc: greybus-dev@lists.linaro.org
Reviewed-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/2024010517-handgun-scoreless-05e7@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/greybus/core.c
include/linux/greybus.h

index 5714be7404707b767da8d7dc7b6ad19a57769410..b0aadc1e7bbed6ece237c7adf35ead8ce9803b80 100644 (file)
@@ -155,7 +155,7 @@ static void greybus_shutdown(struct device *dev)
        }
 }
 
-struct bus_type greybus_bus_type = {
+const struct bus_type greybus_bus_type = {
        .name =         "greybus",
        .match =        greybus_match_device,
        .uevent =       greybus_uevent,
index 18c0fb958b74022663617698258e5ac29c349836..92da9ec4f5f08224343e3da1464f3fcbb92c5cf3 100644 (file)
@@ -104,7 +104,7 @@ void gb_debugfs_init(void);
 void gb_debugfs_cleanup(void);
 struct dentry *gb_debugfs_get(void);
 
-extern struct bus_type greybus_bus_type;
+extern const struct bus_type greybus_bus_type;
 
 extern struct device_type greybus_hd_type;
 extern struct device_type greybus_module_type;