From: Joe Perches <joe@perches.com>
To: "Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>
Cc: Logan Gunthorpe <logang@deltatee.com>,
Oliver O'Halloran <oohall@gmail.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Tyrel Datwyler <tyreld@linux.ibm.com>,
Russell Currey <ruscur@russell.cc>,
Kurt Schwemmer <kurt.schwemmer@microsemi.com>,
Vidya Sagar <vidyas@nvidia.com>,
Xiongfeng Wang <wangxiongfeng2@huawei.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 2/5] PCI/sysfs: Use return value from dsm_label_utf16s_to_utf8s() directly
Date: Thu, 27 May 2021 13:23:29 -0700 [thread overview]
Message-ID: <b6f3d949ca5c1723001494a371d1a74ef0ff72ed.camel@perches.com> (raw)
In-Reply-To: <20210527201650.221944-2-kw@linux.com>
On Thu, 2021-05-27 at 20:16 +0000, Krzysztof Wilczyński wrote:
> Modify the function dsm_label_utf16s_to_utf8s() to directly return the
> number of bytes written into the buffer so that the strlen() used later
> to calculate the length of the buffer can be removed as it would no
> longer be needed.
[]
> diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
[]
> @@ -139,14 +139,17 @@ enum acpi_attr_enum {
> ACPI_ATTR_INDEX_SHOW,
> };
>
>
> -static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
> +static int dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
> {
> int len;
> +
> len = utf16s_to_utf8s((const wchar_t *)obj->buffer.pointer,
> obj->buffer.length,
> UTF16_LITTLE_ENDIAN,
> buf, PAGE_SIZE);
This should be PAGE_SIZE - 1 no?
> buf[len] = '\n';
> +
> + return len;
return len + 1 ?
next prev parent reply other threads:[~2021-05-27 20:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 20:16 [PATCH v5 1/5] PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in "show" functions Krzysztof Wilczyński
2021-05-27 20:16 ` [PATCH v5 2/5] PCI/sysfs: Use return value from dsm_label_utf16s_to_utf8s() directly Krzysztof Wilczyński
2021-05-27 20:23 ` Joe Perches [this message]
2021-05-27 21:34 ` Krzysztof Wilczyński
2021-05-27 20:16 ` [PATCH v5 3/5] PCI/sysfs: Fix trailing newline handling of resource_alignment_param Krzysztof Wilczyński
2021-05-27 20:16 ` [PATCH v5 4/5] PCI/sysfs: Add missing trailing newline to devspec_show() Krzysztof Wilczyński
2021-05-27 20:16 ` [PATCH v5 5/5] PCI/sysfs: Only show value when driver_override is not NULL Krzysztof Wilczyński
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=b6f3d949ca5c1723001494a371d1a74ef0ff72ed.camel@perches.com \
--to=joe@perches.com \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=kurt.schwemmer@microsemi.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=mpe@ellerman.id.au \
--cc=oohall@gmail.com \
--cc=paulus@samba.org \
--cc=ruscur@russell.cc \
--cc=tyreld@linux.ibm.com \
--cc=vidyas@nvidia.com \
--cc=wangxiongfeng2@huawei.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;
as well as URLs for NNTP newsgroup(s).