Skip to contentSkip to conversation

thunderbolt: make tb_bus_type const

PATCH In review Greg Kroah-Hartman 2 participants 3 messages Dec 19, 2023

Subsystems (2)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/1 thunderbolt: make tb_bus_type const

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 <[email protected]>
Cc Michael Jamet <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc Yehezkel Bernat <[email protected]>
---
 drivers/thunderbolt/domain.c | 2 +-
 include/linux/thunderbolt.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/thunderbolt/domain.c +1 -1
index ec7b5f65804e..9fb1a64f3300 100644
@@ -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,
include/linux/thunderbolt.h +1 -1
index 6151c210d987..2c835e5c41f6 100644
@@ -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;
 
Signature · 1 line
2.43.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Greg Kroah-Hartman

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 <[email protected]>
Cc Michael Jamet <[email protected]>
Cc Mika Westerberg <[email protected]>

Or you want me to pick it up?

author maintainer
#2 lore raw
Quoted 5 lines · Mika Westerberg
Quoted 4 lines · Greg Kroah-Hartman

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.

Quoted 8 lines
Quoted 3 lines
Cc Andreas Noever <[email protected]>
Cc Michael Jamet <[email protected]>
Cc Mika Westerberg <[email protected]>

Or you want me to pick it up?

I can, thanks!

greg k-h