mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Xichao Zhao <zhao.xichao@vivo.com>,
	dan.j.williams@intel.com, vishal.l.verma@intel.com,
	ira.weiny@intel.com
Cc: nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvdimm: Use str_plural() to simplify the code
Date: Wed, 27 Aug 2025 11:09:03 -0700	[thread overview]
Message-ID: <d3cd8520-4727-4275-8a61-0dc631109378@intel.com> (raw)
In-Reply-To: <20250827021325.61145-1-zhao.xichao@vivo.com>



On 8/26/25 7:13 PM, Xichao Zhao wrote:
> Use the string choice helper function str_plural() to simplify the code.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/nvdimm/namespace_devs.c | 2 +-
>  drivers/nvdimm/region.c         | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
> index 55cfbf1e0a95..507dcae9dac0 100644
> --- a/drivers/nvdimm/namespace_devs.c
> +++ b/drivers/nvdimm/namespace_devs.c
> @@ -1983,7 +1983,7 @@ static struct device **scan_labels(struct nd_region *nd_region)
>  	}
>  
>  	dev_dbg(&nd_region->dev, "discovered %d namespace%s\n", count,
> -		count == 1 ? "" : "s");
> +		str_plural(count));
>  
>  	if (count == 0) {
>  		struct nd_namespace_pmem *nspm;
> diff --git a/drivers/nvdimm/region.c b/drivers/nvdimm/region.c
> index 88dc062af5f8..68a26002f8b9 100644
> --- a/drivers/nvdimm/region.c
> +++ b/drivers/nvdimm/region.c
> @@ -70,7 +70,7 @@ static int nd_region_probe(struct device *dev)
>  	 * "<async-registered>/<total>" namespace count.
>  	 */
>  	dev_err(dev, "failed to register %d namespace%s, continuing...\n",
> -			err, err == 1 ? "" : "s");
> +			err, str_plural(err));
>  	return 0;
>  }
>  


      reply	other threads:[~2025-08-27 18:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  2:13 Xichao Zhao
2025-08-27 18:09 ` Dave Jiang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3cd8520-4727-4275-8a61-0dc631109378@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.com \
    --cc=zhao.xichao@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®