[PATCH 2/2] block: dev_t components are unsigned

Christoph Hellwig hch at lst.de
Mon Oct 30 07:01:06 PDT 2023


... thus mark the major, first_minor and minors fields in struct gendisk
as such.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 block/genhd.c          | 4 ++--
 include/linux/blkdev.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index cc32a0c704eb84..ceeb30518db696 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -180,7 +180,7 @@ void blkdev_show(struct seq_file *seqf, off_t offset)
 	spin_lock(&major_names_spinlock);
 	for (dp = major_names[major_to_index(offset)]; dp; dp = dp->next)
 		if (dp->major == offset)
-			seq_printf(seqf, "%3d %s\n", dp->major, dp->name);
+			seq_printf(seqf, "%3u %s\n", dp->major, dp->name);
 	spin_unlock(&major_names_spinlock);
 }
 #endif /* CONFIG_PROC_FS */
@@ -896,7 +896,7 @@ static ssize_t disk_range_show(struct device *dev,
 {
 	struct gendisk *disk = dev_to_disk(dev);
 
-	return sprintf(buf, "%d\n", disk->minors);
+	return sprintf(buf, "%u\n", disk->minors);
 }
 
 static ssize_t disk_ext_range_show(struct device *dev,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index eef450f259828d..3ecf928d6325b6 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -130,9 +130,9 @@ struct gendisk {
 	 * major/first_minor/minors should not be set by any new driver, the
 	 * block core will take care of allocating them automatically.
 	 */
-	int major;
-	int first_minor;
-	int minors;
+	unsigned int major;
+	unsigned int first_minor;
+	unsigned int minors;
 
 	char disk_name[DISK_NAME_LEN];	/* name of major driver */
 
-- 
2.39.2




More information about the linux-mtd mailing list