All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: dma: use str_plural helper in register_dmac
@ 2026-06-04 11:34 Thorsten Blum
  2026-06-04 11:47 ` Thorsten Blum
  2026-06-04 12:12 ` Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-06-04 11:34 UTC (permalink / raw)
  To: Rich Felker, John Paul Adrian Glaubitz
  Cc: Thorsten Blum, 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() while at it.

Signed-off-by: Thorsten Blum <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..7c8ee3a0bdf9 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 (%d 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] 3+ messages in thread

* Re: [PATCH] sh: dma: use str_plural helper in register_dmac
  2026-06-04 11:34 [PATCH] sh: dma: use str_plural helper in register_dmac Thorsten Blum
@ 2026-06-04 11:47 ` Thorsten Blum
  2026-06-04 12:12 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-06-04 11:47 UTC (permalink / raw)
  To: Rich Felker, John Paul Adrian Glaubitz; +Cc: linux-sh, linux-kernel

Please note that this patch requires the following to apply cleanly:
https://lore.kernel.org/lkml/20260510161012.108731-4-thorsten.blum@linux.dev/

On Thu, Jun 04, 2026 at 01:34:42PM +0200, Thorsten Blum wrote:
> Replace the manual ternary "s" pluralization with str_plural() to
> simplify the code. This also corrects the "0 channels" case.
> 
> Use pr_info() while at it.
> 
> Signed-off-by: Thorsten Blum <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..7c8ee3a0bdf9 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 (%d 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	[flat|nested] 3+ messages in thread

* Re: [PATCH] sh: dma: use str_plural helper in register_dmac
  2026-06-04 11:34 [PATCH] sh: dma: use str_plural helper in register_dmac Thorsten Blum
  2026-06-04 11:47 ` Thorsten Blum
@ 2026-06-04 12:12 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2026-06-04 12:12 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Rich Felker, John Paul Adrian Glaubitz, linux-sh, linux-kernel

Hi Thorsten,

On Thu, 4 Jun 2026 at 13:36, Thorsten Blum <thorsten.blum@linux.dev> wrote:
> Replace the manual ternary "s" pluralization with str_plural() to
> simplify the code. This also corrects the "0 channels" case.
>
> Use pr_info() while at it.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Thanks for your patch!

> --- 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 (%d channel%s).\n",

%u, while at it?

> +               info->name, info->nr_channels, str_plural(info->nr_channels));
>
>         BUG_ON((info->flags & DMAC_CHANNELS_CONFIGURED) && !info->channels);

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-04 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 11:34 [PATCH] sh: dma: use str_plural helper in register_dmac Thorsten Blum
2026-06-04 11:47 ` Thorsten Blum
2026-06-04 12:12 ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.