summaryrefslogtreecommitdiff
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorHongling Zeng <zenghongling@kylinos.cn>2024-10-19 13:44:26 +0800
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2024-10-21 13:40:12 +0300
commit90a7d74860044f12a359aa3611b5172b44b202dd (patch)
tree0ba652dc5ad37f26e437a61292712f62edc1e11c /drivers/platform/x86
parent3ea5eb68b9d624935108b5e696859304edfac202 (diff)
platform/x86: classmate-laptop: Replace snprintf in show functions with sysfs_emit
show() must not use snprintf() when formatting the value to be returned to user space. Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn> Link: https://lore.kernel.org/r/20241019054426.8182-1-zenghongling@kylinos.cn [ij: Added linux/sysfs.h include] Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/classmate-laptop.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
index cb6fce655e35..6b1b8e444e24 100644
--- a/drivers/platform/x86/classmate-laptop.c
+++ b/drivers/platform/x86/classmate-laptop.c
@@ -12,6 +12,7 @@
#include <linux/backlight.h>
#include <linux/input.h>
#include <linux/rfkill.h>
+#include <linux/sysfs.h>
struct cmpc_accel {
int sensitivity;
@@ -208,7 +209,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 +258,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 +551,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,