From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Hongling Zeng <zenghongling@kylinos.cn>
Cc: LKML <linux-kernel@vger.kernel.org>,
platform-driver-x86@vger.kernel.org, cascardo@holoscopio.com,
Hans de Goede <hdegoede@redhat.com>,
zhongling0719@126.com
Subject: Re: [PATCH v1] platform/x86: classmate-laptop: Replace snprintf in show functions with sysfs_emit
Date: Mon, 21 Oct 2024 13:51:01 +0300 (EEST) [thread overview]
Message-ID: <b584bfe3-59bd-f79c-c540-ec3f29eb7841@linux.intel.com> (raw)
In-Reply-To: <20241019054426.8182-1-zenghongling@kylinos.cn>
On Sat, 19 Oct 2024, Hongling Zeng wrote:
> show() must not use snprintf() when formatting the value to be
> returned to user space.
>
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Hi,
I've applied this with modifications:
- I had to cleanup the extra spaces before show() in the text above which
I had already earlier noted you should fix. :-(
- Added #include <linux/sysfs.h>
--
i.
> ---
> drivers/platform/x86/classmate-laptop.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
> index cb6fce6..14c238f 100644
> --- a/drivers/platform/x86/classmate-laptop.c
> +++ b/drivers/platform/x86/classmate-laptop.c
> @@ -208,7 +208,7 @@ static ssize_t cmpc_accel_sensitivity_show_v4(struct device *dev,
> inputdev = dev_get_drvdata(&acpi->dev);
> accel = dev_get_drvdata(&inputdev->dev);
>
> - return sprintf(buf, "%d\n", accel->sensitivity);
> + return sysfs_emit(buf, "%d\n", accel->sensitivity);
> }
>
> static ssize_t cmpc_accel_sensitivity_store_v4(struct device *dev,
> @@ -257,7 +257,7 @@ static ssize_t cmpc_accel_g_select_show_v4(struct device *dev,
> inputdev = dev_get_drvdata(&acpi->dev);
> accel = dev_get_drvdata(&inputdev->dev);
>
> - return sprintf(buf, "%d\n", accel->g_select);
> + return sysfs_emit(buf, "%d\n", accel->g_select);
> }
>
> static ssize_t cmpc_accel_g_select_store_v4(struct device *dev,
> @@ -550,7 +550,7 @@ static ssize_t cmpc_accel_sensitivity_show(struct device *dev,
> inputdev = dev_get_drvdata(&acpi->dev);
> accel = dev_get_drvdata(&inputdev->dev);
>
> - return sprintf(buf, "%d\n", accel->sensitivity);
> + return sysfs_emit(buf, "%d\n", accel->sensitivity);
> }
>
> static ssize_t cmpc_accel_sensitivity_store(struct device *dev,
>
prev parent reply other threads:[~2024-10-21 10:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-19 5:44 [PATCH v1] platform/x86: classmate-laptop: Replace snprintf in show functions with sysfs_emit Hongling Zeng
2024-10-21 10:51 ` Ilpo Järvinen [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=b584bfe3-59bd-f79c-c540-ec3f29eb7841@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=cascardo@holoscopio.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=zenghongling@kylinos.cn \
--cc=zhongling0719@126.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