There is no good reason for __bdevname to exist. Just open code printing the string in the callers. For three of them the format string can be trivially merged into existing printk statements, and in init/do_mounts.c we can at least do the scnprintf once at the start of the function, and unconditional of CONFIG_BLOCK to make the output for tiny configfs a little more helpful.
Unified · Split
| @@ -57,20 +57,6 @@ const char *bio_devname(struct bio *bio, char *buf) · 56 unmodified lines | ||
| 57 | 57 | } |
| 58 | 58 | EXPORT_SYMBOL(bio_devname); |
| 59 | 59 | |
| 60 | −/* | |
| 61 | − * There's very little reason to use this, you should really | |
| 62 | − * have a struct block_device just about everywhere and use | |
| 63 | − * bdevname() instead. | |
| 64 | − */ | |
| 65 | −const char *__bdevname(dev_t dev, char *buffer) | |
| 66 | −{ | |
| 67 | − scnprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)", | |
| 68 | − MAJOR(dev), MINOR(dev)); | |
| 69 | − return buffer; | |
| 70 | −} | |
| 71 | − | |
| 72 | −EXPORT_SYMBOL(__bdevname); | |
| 73 | − | |
| 74 | 60 | static ssize_t part_partition_show(struct device *dev, |
| 75 | 61 | struct device_attribute *attr, char *buf) |
| 76 | 62 | { |
| @@ -2491,12 +2491,12 @@ static int lock_rdev(struct md_rdev *rdev, dev_t dev, int shared) · 2490 unmodified lines | ||
| 2491 | 2491 | { |
| 2492 | 2492 | int err = 0; |
| 2493 | 2493 | struct block_device *bdev; |
| 2494 | − char b[BDEVNAME_SIZE]; | |
| 2495 | 2494 | |
| 2496 | 2495 | bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, |
| 2497 | 2496 | shared ? (struct md_rdev *)lock_rdev : rdev); |
| 2498 | 2497 | if (IS_ERR(bdev)) { |
| 2499 | − pr_warn("md: could not open %s.\n", __bdevname(dev, b)); | |
| 2498 | + pr_warn("md: could not open device unknown-block(%u,%u).\n", | |
| 2499 | + MAJOR(dev), MINOR(dev)); | |
| 2500 | 2500 | return PTR_ERR(bdev); |
| 2501 | 2501 | } |
| 2502 | 2502 | rdev->bdev = bdev; |
| @@ -927,7 +927,6 @@ void ext4_update_dynamic_rev(struct super_block *sb) · 926 unmodified lines | ||
| 927 | 927 | static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb) |
| 928 | 928 | { |
| 929 | 929 | struct block_device *bdev; |
| 930 | − char b[BDEVNAME_SIZE]; | |
| 931 | 930 | |
| 932 | 931 | bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb); |
| 933 | 932 | if (IS_ERR(bdev)) |
| @@ -935,8 +934,9 @@ static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb) · 1 unmodified line | ||
| 935 | 934 | return bdev; |
| 936 | 935 | |
| 937 | 936 | fail: |
| 938 | − ext4_msg(sb, KERN_ERR, "failed to open journal device %s: %ld", | |
| 939 | − __bdevname(dev, b), PTR_ERR(bdev)); | |
| 937 | + ext4_msg(sb, KERN_ERR, | |
| 938 | + "failed to open journal device unknown-block(%u,%u) %ld", | |
| 939 | + MAJOR(dev), MINOR(dev), PTR_ERR(bdev)); | |
| 940 | 940 | return NULL; |
| 941 | 941 | } |
| 942 | 942 | |
| @@ -2599,7 +2599,6 @@ static int journal_init_dev(struct super_block *super, · 2598 unmodified lines | ||
| 2599 | 2599 | int result; |
| 2600 | 2600 | dev_t jdev; |
| 2601 | 2601 | fmode_t blkdev_mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; |
| 2602 | − char b[BDEVNAME_SIZE]; | |
| 2603 | 2602 | |
| 2604 | 2603 | result = 0; |
| 2605 | 2604 | |
| @@ -2621,8 +2620,8 @@ static int journal_init_dev(struct super_block *super, · 15 unmodified lines | ||
| 2621 | 2620 | result = PTR_ERR(journal->j_dev_bd); |
| 2622 | 2621 | journal->j_dev_bd = NULL; |
| 2623 | 2622 | reiserfs_warning(super, "sh-458", |
| 2624 | − "cannot init journal device '%s': %i", | |
| 2625 | − __bdevname(jdev, b), result); | |
| 2623 | + "cannot init journal device unknown-block(%u,%u): %i", | |
| 2624 | + MAJOR(jdev), MINOR(jdev), result); | |
| 2626 | 2625 | return result; |
| 2627 | 2626 | } else if (jdev != super->s_dev) |
| 2628 | 2627 | set_blocksize(journal->j_dev_bd, super->s_blocksize); |
| @@ -2699,7 +2699,6 @@ static inline void unregister_chrdev(unsigned int major, const char *name) · 2698 unmodified lines | ||
| 2699 | 2699 | |
| 2700 | 2700 | #ifdef CONFIG_BLOCK |
| 2701 | 2701 | #define BLKDEV_MAJOR_MAX 512 |
| 2702 | −extern const char *__bdevname(dev_t, char *buffer); | |
| 2703 | 2702 | extern const char *bdevname(struct block_device *bdev, char *buffer); |
| 2704 | 2703 | extern struct block_device *lookup_bdev(const char *); |
| 2705 | 2704 | extern void blkdev_show(struct seq_file *,off_t); |
| @@ -429,12 +429,10 @@ void __init mount_block_root(char *name, int flags) · 428 unmodified lines | ||
| 429 | 429 | struct page *page = alloc_page(GFP_KERNEL); |
| 430 | 430 | char *fs_names = page_address(page); |
| 431 | 431 | char *p; |
| 432 | −#ifdef CONFIG_BLOCK | |
| 433 | 432 | char b[BDEVNAME_SIZE]; |
| 434 | −#else | |
| 435 | − const char *b = name; | |
| 436 | −#endif | |
| 437 | 433 | |
| 434 | + scnprintf(b, BDEVNAME_SIZE, "unknown-block(%u,%u)", | |
| 435 | + MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); | |
| 438 | 436 | get_fs_names(fs_names); |
| 439 | 437 | retry: |
| 440 | 438 | for (p = fs_names; *p; p += strlen(p)+1) { |
| @@ -451,9 +449,6 @@ retry: · 10 unmodified lines | ||
| 451 | 449 | * and bad superblock on root device. |
| 452 | 450 | * and give them a list of the available devices |
| 453 | 451 | */ |
| 454 | −#ifdef CONFIG_BLOCK | |
| 455 | − __bdevname(ROOT_DEV, b); | |
| 456 | −#endif | |
| 457 | 452 | printk("VFS: Cannot open root device \"%s\" or %s: error %d\n", |
| 458 | 453 | root_device_name, b, err); |
| 459 | 454 | printk("Please append a correct \"root=\" boot option; here are the available partitions:\n"); |
| @@ -476,9 +471,6 @@ retry: · 16 unmodified lines | ||
| 476 | 471 | for (p = fs_names; *p; p += strlen(p)+1) |
| 477 | 472 | printk(" %s", p); |
| 478 | 473 | printk("\n"); |
| 479 | −#ifdef CONFIG_BLOCK | |
| 480 | − __bdevname(ROOT_DEV, b); | |
| 481 | −#endif | |
| 482 | 474 | panic("VFS: Unable to mount root fs on %s", b); |
| 483 | 475 | out: |
| 484 | 476 | put_page(page); |