thunderbolt: make tb_bus_type const
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Dec 2023 15:43:05 +0000 (16:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 07:21:57 +0000 (08:21 +0100)
Now that the driver core can properly handle constant struct bus_type,
move the tb_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Andreas Noever <andreas.noever@gmail.com>
Cc: Michael Jamet <michael.jamet@intel.com>
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>
Cc: <linux-usb@vger.kernel.org>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/2023121904-utopia-broadcast-06d1@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/thunderbolt/domain.c
include/linux/thunderbolt.h

index ec7b5f65804e49e82533d6493c4cb90df514f2e2..9fb1a64f3300b8fcf7ebc1f7dafa6a68778da122 100644 (file)
@@ -307,7 +307,7 @@ static const struct attribute_group *domain_attr_groups[] = {
        NULL,
 };
 
-struct bus_type tb_bus_type = {
+const struct bus_type tb_bus_type = {
        .name = "thunderbolt",
        .match = tb_service_match,
        .probe = tb_service_probe,
index 6151c210d987d4468aa84c6bcb3584256548a1ca..2c835e5c41f6303da0d86e25619a5dbedc4743d3 100644 (file)
@@ -86,7 +86,7 @@ struct tb {
        unsigned long privdata[];
 };
 
-extern struct bus_type tb_bus_type;
+extern const struct bus_type tb_bus_type;
 extern struct device_type tb_service_type;
 extern struct device_type tb_xdomain_type;