diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-09-12 09:46:52 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-09-15 14:47:14 +0200 |
| commit | beb022ef9263d0c5b1a994fa3ab5d3244a01aaa1 (patch) | |
| tree | e458dd6d46ce1813011250fc421ac8c53baae477 | |
| parent | e60625e7ce10f696690d9e36a9f32fc7c1897f79 (diff) | |
initrd: Use str_plural() in rd_load_image()
Add the local variable 'nr_disks' and replace the manual ternary "s"
pluralization with the standardized str_plural() helper function.
Use pr_notice() instead of printk(KERN_NOTICE) to silence a checkpatch
warning.
No functional changes intended.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
| -rw-r--r-- | init/do_mounts_rd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index 3cbdf43a42df..19d9f33dcacf 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c @@ -7,6 +7,7 @@ #include <uapi/linux/cramfs_fs.h> #include <linux/initrd.h> #include <linux/string.h> +#include <linux/string_choices.h> #include <linux/slab.h> #include "do_mounts.h" @@ -186,7 +187,7 @@ static unsigned long nr_blocks(struct file *file) int __init rd_load_image(char *from) { int res = 0; - unsigned long rd_blocks, devblocks; + unsigned long rd_blocks, devblocks, nr_disks; int nblocks, i; char *buf = NULL; unsigned short rotate = 0; @@ -242,8 +243,9 @@ int __init rd_load_image(char *from) goto done; } - printk(KERN_NOTICE "RAMDISK: Loading %dKiB [%ld disk%s] into ram disk... ", - nblocks, ((nblocks-1)/devblocks)+1, nblocks>devblocks ? "s" : ""); + nr_disks = (nblocks - 1) / devblocks + 1; + pr_notice("RAMDISK: Loading %dKiB [%ld disk%s] into ram disk... ", + nblocks, nr_disks, str_plural(nr_disks)); for (i = 0; i < nblocks; i++) { if (i && (i % devblocks == 0)) { pr_cont("done disk #1.\n"); |