* [PATH] platform/x86: classmate-laptop: Replace snprintf in show functions with sysfs_emit
@ 2024-10-18 7:22 zenghongling
2024-10-18 8:32 ` Ilpo Järvinen
0 siblings, 1 reply; 2+ messages in thread
From: zenghongling @ 2024-10-18 7:22 UTC (permalink / raw)
To: linux-kernel, platform-driver-x86
Cc: cascardo, hdegoede, ilpo.jarvinen, zhongling0719, zenghongling
show() must not use snprintf() when formatting the value to be
returned to user space.
Signed-off-by: zenghongling <zenghongling@kylinos.cn>
---
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,
--
2.1.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATH] platform/x86: classmate-laptop: Replace snprintf in show functions with sysfs_emit
2024-10-18 7:22 [PATH] platform/x86: classmate-laptop: Replace snprintf in show functions with sysfs_emit zenghongling
@ 2024-10-18 8:32 ` Ilpo Järvinen
0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2024-10-18 8:32 UTC (permalink / raw)
To: zenghongling
Cc: LKML, platform-driver-x86, cascardo, Hans de Goede, zhongling0719
On Fri, 18 Oct 2024, zenghongling wrote:
> show() must not use snprintf() when formatting the value to be
Extra spaces.
> returned to user space.
>
> Signed-off-by: zenghongling <zenghongling@kylinos.cn>
Could you please add spaces and the usual capitalization to your name
(both into the Signed-off-by and From).
It is possible to use git config to set up your user.name to get the name
formatting to stick.
--
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,
>
--
i.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-18 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-18 7:22 [PATH] platform/x86: classmate-laptop: Replace snprintf in show functions with sysfs_emit zenghongling
2024-10-18 8:32 ` Ilpo Järvinen
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®