driver core: container: make container_subsys const
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Dec 2023 15:03:20 +0000 (16:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Dec 2023 12:56:10 +0000 (13:56 +0100)
Now that the driver core can properly handle constant struct bus_type,
move the container_subsys variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Link: https://lore.kernel.org/r/2023121919-chatter-grumbling-9ef3@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/container.c
include/linux/container.h

index 1ba42d2d353223e683be57bad5154df07abda10e..f40588ebc3f557216055af8f26196405c471e8b1 100644 (file)
@@ -24,7 +24,7 @@ static int container_offline(struct device *dev)
        return cdev->offline ? cdev->offline(cdev) : 0;
 }
 
-struct bus_type container_subsys = {
+const struct bus_type container_subsys = {
        .name = CONTAINER_BUS_NAME,
        .dev_name = CONTAINER_BUS_NAME,
        .online = trivial_online,
index 2566a1baa736a27127530e58be0f045b48084af3..dd00cc918a926e862d887869acaf9c6fc723a76b 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/device.h>
 
 /* drivers/base/power/container.c */
-extern struct bus_type container_subsys;
+extern const struct bus_type container_subsys;
 
 struct container_dev {
        struct device dev;