Re: [PATCH] sh: dma: use str_plural helper in register_dmac

Geert Uytterhoeven <[email protected]> Thu, 4 Jun 2026 14:12:20 +0200
Newsgroups org.kernel.vger.linux-sh,org.kernel.vger.linux-kernel
Message-ID <CAMuHMdUthkKaEGbedvXX49TFUhnrijSG+muAv8hsHQobTQTJSw@mail.gmail.com>
Hi Thorsten,

On Thu, 4 Jun 2026 at 13:36, Thorsten Blum <[email protected]> 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 <[email protected]>

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 <[email protected]>

Gr{oetje,eeting}s,

                        Geert

-- 
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