Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Thorsten Blum and committed by
Christian Brauner
beb022ef e60625e7

+5 -3
+5 -3
init/do_mounts_rd.c
··· 7 7 #include <uapi/linux/cramfs_fs.h> 8 8 #include <linux/initrd.h> 9 9 #include <linux/string.h> 10 + #include <linux/string_choices.h> 10 11 #include <linux/slab.h> 11 12 12 13 #include "do_mounts.h" ··· 187 186 int __init rd_load_image(char *from) 188 187 { 189 188 int res = 0; 190 - unsigned long rd_blocks, devblocks; 189 + unsigned long rd_blocks, devblocks, nr_disks; 191 190 int nblocks, i; 192 191 char *buf = NULL; 193 192 unsigned short rotate = 0; ··· 243 242 goto done; 244 243 } 245 244 246 - printk(KERN_NOTICE "RAMDISK: Loading %dKiB [%ld disk%s] into ram disk... ", 247 - nblocks, ((nblocks-1)/devblocks)+1, nblocks>devblocks ? "s" : ""); 245 + nr_disks = (nblocks - 1) / devblocks + 1; 246 + pr_notice("RAMDISK: Loading %dKiB [%ld disk%s] into ram disk... ", 247 + nblocks, nr_disks, str_plural(nr_disks)); 248 248 for (i = 0; i < nblocks; i++) { 249 249 if (i && (i % devblocks == 0)) { 250 250 pr_cont("done disk #1.\n");