From: David Laight <david.laight.linux@gmail.com>
To: Xichao Zhao <zhao.xichao@vivo.com>
Cc: joro@8bytes.org, will@kernel.org, suravee.suthikulpanit@amd.com,
robin.murphy@arm.com, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/amd: use str_plural() to simplify the code
Date: Wed, 20 Aug 2025 19:03:59 +0100 [thread overview]
Message-ID: <20250820190359.2680af50@pumpkin> (raw)
In-Reply-To: <20250818035331.393560-1-zhao.xichao@vivo.com>
On Mon, 18 Aug 2025 11:53:31 +0800
Xichao Zhao <zhao.xichao@vivo.com> wrote:
> Use the string choice helper function str_plural() to simplify the code.
This also changes (maybe fixes) the code my adding "s" for zero.
Although I'd define it as ("s" + !!count) - almost certainly generates
better code.
David
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
> drivers/iommu/amd/iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index eb348c63a8d0..b5c829f89544 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -265,7 +265,7 @@ static inline int get_acpihid_device_id(struct device *dev,
> return -EINVAL;
> if (fw_bug)
> dev_err_once(dev, FW_BUG "No ACPI device matched UID, but %d device%s matched HID.\n",
> - hid_count, hid_count > 1 ? "s" : "");
> + hid_count, str_plural(hid_count));
> if (hid_count > 1)
> return -EINVAL;
> if (entry)
next prev parent reply other threads:[~2025-08-20 18:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-18 3:53 [PATCH] iommu/amd: use str_plural() to simplify the code Xichao Zhao
2025-08-18 6:53 ` Christophe JAILLET
2025-08-20 18:03 ` David Laight [this message]
2025-08-21 5:23 ` Ankit Soni
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=20250820190359.2680af50@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=will@kernel.org \
--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 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.