Skip to contentSkip to conversation

block: rbd: make rbd_bus_type const

PATCH Applied Ricardo B. Marliere 4 participants 4 messages Feb 4, 2024 – Feb 6, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: rbd: make rbd_bus_type const

Now that the driver core can properly handle constant struct bus_type, move the rbd_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 drivers/block/rbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rbd.c +1 -1
index 0202a4e5d6cf..21f2b9e9b9ff 100644
@@ -575,7 +575,7 @@ static const struct attribute_group rbd_bus_group = {
 };
 __ATTRIBUTE_GROUPS(rbd_bus);
 
-static struct bus_type rbd_bus_type = {
+static const struct bus_type rbd_bus_type = {
 	.name		= "rbd",
 	.bus_groups	= rbd_bus_groups,
 };

---
base-commit: aa826a9b19b93bf8aabc462381ae436a60b2a320
change-id: 20240204-bus_cleanup-block-9986bfea7975

Best regards,

Signature · 1 line
Ricardo B. Marliere <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type, move the rbd_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

Great!

Quoted 23 lines
---
  drivers/block/rbd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rbd.c +1 -2
index 0202a4e5d6cf..21f2b9e9b9ff 100644
@@ -575,7 +575,7 @@ static const struct attribute_group rbd_bus_group = {
  };
  __ATTRIBUTE_GROUPS(rbd_bus);
 
-static struct bus_type rbd_bus_type = {
+static const struct bus_type rbd_bus_type = {
  	.name		= "rbd",
  	.bus_groups	= rbd_bus_groups,
  };
 
---

base-commit: aa826a9b19b93bf8aabc462381ae436a60b2a320
change-id: 20240204-bus_cleanup-block-9986bfea7975

Best regards,

Reviewed-by on v1 1/1
#2 lore raw
In reply to Ricardo B. Marliere
Quoted 7 lines · Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type, move the rbd_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

maintainer Applied
#3 lore raw
In reply to Ricardo B. Marliere
Quoted 5 lines · Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type, move the rbd_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

Applied, thanks!

[1/1] block: rbd: make rbd_bus_type const

      commit: 052618c71c66d5de5e9b6cbcbad26932d951919c

Best regards,

Signature · 1 line
Jens Axboe