]> www.infradead.org Git - users/hch/block.git/commitdiff
block: use the %pg format specifier in printk_all_partitions
authorChristoph Hellwig <hch@lst.de>
Fri, 23 Jul 2021 06:17:47 +0000 (08:17 +0200)
committerChristoph Hellwig <hch@lst.de>
Sun, 25 Jul 2021 05:36:53 +0000 (07:36 +0200)
Simplify printing the partition name by using the %pg format specifier
that is equivalent to a bdevname call.

Signed-off-by: Christoph Hellwig <hch@lst.de>
block/genhd.c

index 80ad858224193a7eeb4db8b17a1702e6ac3a19c0..e07b1b028875bcf44a1c0cacc6ee37182c28749e 100644 (file)
@@ -683,7 +683,6 @@ void __init printk_all_partitions(void)
        while ((dev = class_dev_iter_next(&iter))) {
                struct gendisk *disk = dev_to_disk(dev);
                struct block_device *part;
-               char name_buf[BDEVNAME_SIZE];
                char devt_buf[BDEVT_SIZE];
                unsigned long idx;
 
@@ -703,11 +702,10 @@ void __init printk_all_partitions(void)
                xa_for_each(&disk->part_tbl, idx, part) {
                        if (!bdev_nr_sectors(part))
                                continue;
-                       printk("%s%s %10llu %s %s",
+                       printk("%s%s %10llu %pg %s",
                               bdev_is_partition(part) ? "  " : "",
                               bdevt_str(part->bd_dev, devt_buf),
-                              bdev_nr_sectors(part) >> 1,
-                              disk_name(disk, part->bd_partno, name_buf),
+                              bdev_nr_sectors(part) >> 1, part,
                               part->bd_meta_info ?
                                        part->bd_meta_info->uuid : "");
                        if (bdev_is_partition(part))