Skip to contentSkip to conversation

sh: sq: use str_plural helper in sq_remap

PATCH In review Thorsten Blum 2 participants 2 messages Jun 4 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: sq: use str_plural helper in sq_remap

Replace the manual ternary "s" pluralization with str_plural() to simplify the code. Use the format specifier %-1s to preserve the whitespace alignment.

Simplify the map->name ternary expression while at it.

---
 arch/sh/kernel/cpu/sh4/sq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/sh/kernel/cpu/sh4/sq.c +3 -3
index 908a8e09113b..0f9244be6dcc 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/string_choices.h>
 #include <linux/vmalloc.h>
 #include <linux/mm.h>
 #include <linux/io.h>
@@ -181,9 +182,8 @@ unsigned long sq_remap(unsigned long phys, unsigned int size,
 		goto out;
 
 	psz = (size + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
-	pr_info("sqremap: %15s  [%4d page%s]  va 0x%08lx   pa 0x%08lx\n",
-		likely(map->name) ? map->name : "???",
-		psz, psz == 1 ? " " : "s",
+	pr_info("sqremap: %15s  [%4d page%-1s]  va 0x%08lx   pa 0x%08lx\n",
+		map->name ?: "???", psz, str_plural(psz),
 		map->sq_addr, map->addr);
 
 	sq_mapping_list_add(map);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Thorsten Blum

Replace the manual ternary "s" pluralization with str_plural() to simplify the code. Use the format specifier %-1s to preserve the whitespace alignment.

Simplify the map->name ternary expression while at it.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds