mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 22:24:11 +08:00
platform/x86: eeepc-laptop: use sysfs_emit() instead of sprintf()
Follow the advice in Documentation/filesystems/sysfs.rst: show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: chen zhang <chenzhang@kylinos.cn> Link: https://lore.kernel.org/r/20241023012905.15551-1-chenzhang@kylinos.cn Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
1349dd7dc2
commit
a7d30cb75b
@ -25,6 +25,7 @@
|
||||
#include <linux/rfkill.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/pci_hotplug.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <acpi/video.h>
|
||||
@ -285,7 +286,7 @@ static ssize_t show_sys_acpi(struct device *dev, int cm, char *buf)
|
||||
|
||||
if (value < 0)
|
||||
return -EIO;
|
||||
return sprintf(buf, "%d\n", value);
|
||||
return sysfs_emit(buf, "%d\n", value);
|
||||
}
|
||||
|
||||
#define EEEPC_ACPI_SHOW_FUNC(_name, _cm) \
|
||||
@ -361,7 +362,7 @@ static ssize_t cpufv_show(struct device *dev,
|
||||
|
||||
if (get_cpufv(eeepc, &c))
|
||||
return -ENODEV;
|
||||
return sprintf(buf, "%#x\n", (c.num << 8) | c.cur);
|
||||
return sysfs_emit(buf, "%#x\n", (c.num << 8) | c.cur);
|
||||
}
|
||||
|
||||
static ssize_t cpufv_store(struct device *dev,
|
||||
@ -393,7 +394,7 @@ static ssize_t cpufv_disabled_show(struct device *dev,
|
||||
{
|
||||
struct eeepc_laptop *eeepc = dev_get_drvdata(dev);
|
||||
|
||||
return sprintf(buf, "%d\n", eeepc->cpufv_disabled);
|
||||
return sysfs_emit(buf, "%d\n", eeepc->cpufv_disabled);
|
||||
}
|
||||
|
||||
static ssize_t cpufv_disabled_store(struct device *dev,
|
||||
@ -1025,7 +1026,7 @@ static ssize_t store_sys_hwmon(void (*set)(int), const char *buf, size_t count)
|
||||
|
||||
static ssize_t show_sys_hwmon(int (*get)(void), char *buf)
|
||||
{
|
||||
return sprintf(buf, "%d\n", get());
|
||||
return sysfs_emit(buf, "%d\n", get());
|
||||
}
|
||||
|
||||
#define EEEPC_SENSOR_SHOW_FUNC(_name, _get) \
|
||||
|
Loading…
Reference in New Issue
Block a user