Input: serio - make serio_bus const
authorRicardo B. Marliere <ricardo@marliere.net>
Sun, 3 Mar 2024 23:05:42 +0000 (15:05 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 3 Mar 2024 23:06:58 +0000 (15:06 -0800)
Now that the driver core can properly handle constant struct bus_type,
move the serio_bus variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Link: https://lore.kernel.org/r/20240210-bus_cleanup-input2-v1-2-0daef7e034e0@marliere.net
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/serio/serio.c
include/linux/serio.h

index 767fc9e..a8838b5 100644 (file)
@@ -1007,7 +1007,7 @@ irqreturn_t serio_interrupt(struct serio *serio,
 }
 EXPORT_SYMBOL(serio_interrupt);
 
-struct bus_type serio_bus = {
+const struct bus_type serio_bus = {
        .name           = "serio",
        .drv_groups     = serio_driver_groups,
        .match          = serio_bus_match,
index 6c27d41..7ca41af 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/mod_devicetable.h>
 #include <uapi/linux/serio.h>
 
-extern struct bus_type serio_bus;
+extern const struct bus_type serio_bus;
 
 struct serio {
        void *port_data;