* [PATCH v2] sh: dma: use str_plural helper in register_dmac
@ 2026-06-04 12:44 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-06-04 12:44 UTC (permalink / raw)
To: Rich Felker, John Paul Adrian Glaubitz
Cc: Thorsten Blum, Geert Uytterhoeven, linux-sh, linux-kernel
Replace the manual ternary "s" pluralization with str_plural() to
simplify the code. This also corrects the "0 channels" case.
Use pr_info() and %u for ->nr_channels while at it.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Changes in v2:
- Replace %d with %u for unsigned int ->nr_channels while at it (Geert)
- v1: https://lore.kernel.org/lkml/20260604113442.1303771-3-thorsten.blum@linux.dev/
---
arch/sh/drivers/dma/dma-api.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index 31b614358270..7b18bd81ab61 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -17,6 +17,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <linux/string_choices.h>
#include <asm/dma.h>
DEFINE_SPINLOCK(dma_spin_lock);
@@ -200,8 +201,8 @@ int register_dmac(struct dma_info *info)
INIT_LIST_HEAD(&info->list);
- printk(KERN_INFO "DMA: Registering %s handler (%d channel%s).\n",
- info->name, info->nr_channels, info->nr_channels > 1 ? "s" : "");
+ pr_info("DMA: Registering %s handler (%u channel%s).\n",
+ info->name, info->nr_channels, str_plural(info->nr_channels));
BUG_ON((info->flags & DMAC_CHANNELS_CONFIGURED) && !info->channels);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-04 12:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 12:44 [PATCH v2] sh: dma: use str_plural helper in register_dmac Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox