Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

firmware: arm_scmi: Make scmi_bus_type const

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>

authored by

Ricardo B. Marliere and committed by
Sudeep Holla
961745b2 f1d71576

+2 -2
+1 -1
drivers/firmware/arm_scmi/bus.c
··· 283 283 scmi_drv->remove(scmi_dev); 284 284 } 285 285 286 - struct bus_type scmi_bus_type = { 286 + const struct bus_type scmi_bus_type = { 287 287 .name = "scmi_protocol", 288 288 .match = scmi_dev_match, 289 289 .probe = scmi_dev_probe,
+1 -1
drivers/firmware/arm_scmi/common.h
··· 141 141 void scmi_setup_protocol_implemented(const struct scmi_protocol_handle *ph, 142 142 u8 *prot_imp); 143 143 144 - extern struct bus_type scmi_bus_type; 144 + extern const struct bus_type scmi_bus_type; 145 145 146 146 #define SCMI_BUS_NOTIFY_DEVICE_REQUEST 0 147 147 #define SCMI_BUS_NOTIFY_DEVICE_UNREQUEST 1