From: Hans de Goede <hdegoede@redhat.com>
To: ye.xingchen@zte.com.cn
Cc: malattia@linux.it, markgross@kernel.org,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/x86: sony-laptop: Convert to use sysfs_emit_at() API
Date: Thu, 8 Dec 2022 17:32:28 +0100 [thread overview]
Message-ID: <27423188-10ed-be55-3080-570a476b2899@redhat.com> (raw)
In-Reply-To: <202212081545178689771@zte.com.cn>
Hi,
On 12/8/22 08:45, ye.xingchen@zte.com.cn wrote:
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> Follow the advice of the Documentation/filesystems/sysfs.rst and show()
> should only use sysfs_emit() or sysfs_emit_at() when formatting the
> value to be returned to user space.
>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/x86/sony-laptop.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index a19aac70252f..7156ae2ad196 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -820,10 +820,9 @@ static ssize_t sony_nc_handles_show(struct device *dev,
> int i;
>
> for (i = 0; i < ARRAY_SIZE(handles->cap); i++) {
> - len += scnprintf(buffer + len, PAGE_SIZE - len, "0x%.4x ",
> - handles->cap[i]);
> + len += sysfs_emit_at(buffer, len, "0x%.4x ", handles->cap[i]);
> }
> - len += scnprintf(buffer + len, PAGE_SIZE - len, "\n");
> + len += sysfs_emit_at(buffer, len, "\n");
>
> return len;
> }
> @@ -2173,10 +2172,9 @@ static ssize_t sony_nc_thermal_profiles_show(struct device *dev,
>
> for (cnt = 0; cnt < THM_PROFILE_MAX; cnt++) {
> if (!cnt || (th_handle->profiles & cnt))
> - idx += scnprintf(buffer + idx, PAGE_SIZE - idx, "%s ",
> - snc_thermal_profiles[cnt]);
> + idx += sysfs_emit_at(buffer, idx, "%s ", snc_thermal_profiles[cnt]);
> }
> - idx += scnprintf(buffer + idx, PAGE_SIZE - idx, "\n");
> + idx += sysfs_emit_at(buffer, idx, "\n");
>
> return idx;
> }
prev parent reply other threads:[~2022-12-08 16:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-08 7:45 ye.xingchen
2022-12-08 16:32 ` Hans de Goede [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=27423188-10ed-be55-3080-570a476b2899@redhat.com \
--to=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=malattia@linux.it \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=ye.xingchen@zte.com.cn \
/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®