2023-04-19 07:55:40

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH 0/4] block: constify some structures of partitions/core.c

A few structures containing function pointers that could and should be
const are not. Change that.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
Thomas Weißschuh (4):
block: constify partition prober array
block: constify struct part_type part_type
block: constify struct part_attr_group
block: constify the whole_disk device_attribute

block/partitions/core.c | 8 ++++----
include/linux/blkdev.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
---
base-commit: af67688dca57999fd848f051eeea1d375ba546b2
change-id: 20230419-const-partition-a06b9f76b2f3

Best regards,
--
Thomas Weißschuh <[email protected]>


2023-04-19 07:55:49

by Thomas Weißschuh

[permalink] [raw]
Subject: [PATCH 2/4] block: constify struct part_type part_type

The struct is never modified so it can be const.

Signed-off-by: Thomas Weißschuh <[email protected]>
---
block/partitions/core.c | 2 +-
include/linux/blkdev.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/partitions/core.c b/block/partitions/core.c
index 667f3dcebd59..812407ea38e9 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -264,7 +264,7 @@ static int part_uevent(const struct device *dev, struct kobj_uevent_env *env)
return 0;
}

-struct device_type part_type = {
+const struct device_type part_type = {
.name = "partition",
.groups = part_attr_groups,
.release = part_release,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 941304f17492..de783481ec71 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -41,7 +41,7 @@ struct blk_stat_callback;
struct blk_crypto_profile;

extern const struct device_type disk_type;
-extern struct device_type part_type;
+extern const struct device_type part_type;
extern struct class block_class;

/* Must be consistent with blk_mq_poll_stats_bkt() */

--
2.40.0