firmware: arm_scmi: Make scmi_bus_type const
authorRicardo B. Marliere <ricardo@marliere.net>
Sun, 11 Feb 2024 15:51:30 +0000 (12:51 -0300)
committerSudeep Holla <sudeep.holla@arm.com>
Tue, 20 Feb 2024 06:35:55 +0000 (06:35 +0000)
Now that the driver core can properly handle constant struct bus_type,
move the scmi_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: Cristian Marussi <cristian.marussi@arm.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240211-bus_cleanup-firmware2-v1-2-1851c92c7be7@marliere.net
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/bus.c
drivers/firmware/arm_scmi/common.h

index 1f9735dbebec712f577898d914939682e50cbf1b..77c78be6e79c959fd8a15319b12e21e92e3f8c54 100644 (file)
@@ -283,7 +283,7 @@ static void scmi_dev_remove(struct device *dev)
                scmi_drv->remove(scmi_dev);
 }
 
-struct bus_type scmi_bus_type = {
+const struct bus_type scmi_bus_type = {
        .name = "scmi_protocol",
        .match = scmi_dev_match,
        .probe = scmi_dev_probe,
index 00b165d1f502df7816527298996f196585d10f5a..6affbfdd1dec1aeedb82dc53adbef3d182e33d02 100644 (file)
@@ -141,7 +141,7 @@ scmi_revision_area_get(const struct scmi_protocol_handle *ph);
 void scmi_setup_protocol_implemented(const struct scmi_protocol_handle *ph,
                                     u8 *prot_imp);
 
-extern struct bus_type scmi_bus_type;
+extern const struct bus_type scmi_bus_type;
 
 #define SCMI_BUS_NOTIFY_DEVICE_REQUEST         0
 #define SCMI_BUS_NOTIFY_DEVICE_UNREQUEST       1