From: Hans de Goede <hdegoede@redhat.com>
To: yunshui <jiangyunshui@kylinos.cn>,
linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org
Cc: corentin.chary@gmail.com, ilpo.jarvinen@linux.intel.com,
Ai Chao <aichao@kylinos.cn>
Subject: Re: [PATCH] platform/x86: samsung-laptop: Use sysfs_emit() to replace the old interface sprintf()
Date: Thu, 18 Apr 2024 10:46:23 +0200 [thread overview]
Message-ID: <5f8fac08-5368-443c-853e-6587b635e39b@redhat.com> (raw)
In-Reply-To: <20240418070550.628310-1-jiangyunshui@kylinos.cn>
Hi,
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
On 4/18/24 9:05 AM, yunshui wrote:
> As Documentation/filesystems/sysfs.rst suggested,
> show() should only use sysfs_emit() or sysfs_emit_at() when formatting
> the value to be returned to user space.
>
> Signed-off-by: yunshui <jiangyunshui@kylinos.cn>
> Signed-off-by: Ai Chao <aichao@kylinos.cn>
But this double Signed-off-by is weird, looking at the From:
you (yunshui) are the author so your Signed-off-by is expected.
But Ai Chao's Signed-off-by here is weird, I would only
expect that if Ai Chao would be submitting the patch on
your behalf (for whatever reason). Signed-off-by indicates
that you're either the author or the patch passed through
your hands. So I'll add my S-o-b for example when applying
this to my review-hans branch.
I guess you may want:
Reviewed-by: Ai Chao <aichao@kylinos.cn>
here and in the other similar sysfs_emit() patches ?
Regards,
Hans
> ---
> drivers/platform/x86/samsung-laptop.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
> index b4aa8ba35d2d..3d2f8e758369 100644
> --- a/drivers/platform/x86/samsung-laptop.c
> +++ b/drivers/platform/x86/samsung-laptop.c
> @@ -661,9 +661,9 @@ static ssize_t get_performance_level(struct device *dev,
> /* The logic is backwards, yeah, lots of fun... */
> for (i = 0; config->performance_levels[i].name; ++i) {
> if (sretval.data[0] == config->performance_levels[i].value)
> - return sprintf(buf, "%s\n", config->performance_levels[i].name);
> + return sysfs_emit(buf, "%s\n", config->performance_levels[i].name);
> }
> - return sprintf(buf, "%s\n", "unknown");
> + return sysfs_emit(buf, "%s\n", "unknown");
> }
>
> static ssize_t set_performance_level(struct device *dev,
> @@ -744,7 +744,7 @@ static ssize_t get_battery_life_extender(struct device *dev,
> if (ret < 0)
> return ret;
>
> - return sprintf(buf, "%d\n", ret);
> + return sysfs_emit(buf, "%d\n", ret);
> }
>
> static ssize_t set_battery_life_extender(struct device *dev,
> @@ -813,7 +813,7 @@ static ssize_t get_usb_charge(struct device *dev,
> if (ret < 0)
> return ret;
>
> - return sprintf(buf, "%d\n", ret);
> + return sysfs_emit(buf, "%d\n", ret);
> }
>
> static ssize_t set_usb_charge(struct device *dev,
> @@ -878,7 +878,7 @@ static ssize_t get_lid_handling(struct device *dev,
> if (ret < 0)
> return ret;
>
> - return sprintf(buf, "%d\n", ret);
> + return sysfs_emit(buf, "%d\n", ret);
> }
>
> static ssize_t set_lid_handling(struct device *dev,
prev parent reply other threads:[~2024-04-18 8:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 7:05 [PATCH] platform/x86: samsung-laptop: Use sysfs_emit() to replace the old interface sprintf() yunshui
2024-04-18 8:46 ` 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=5f8fac08-5368-443c-853e-6587b635e39b@redhat.com \
--to=hdegoede@redhat.com \
--cc=aichao@kylinos.cn \
--cc=corentin.chary@gmail.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jiangyunshui@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).