diff options
author | Li Zhijian <lizhijian@fujitsu.com> | 2024-03-19 13:45:27 +0800 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.com> | 2024-04-03 13:42:04 +0200 |
commit | 209eb1f30e9bb305c92f0a53ce6f6ddf5a9f4060 (patch) | |
tree | 112ac8c8921b8044e00afcd8e50cb122440e1181 /drivers/hid/hid-corsair.c | |
parent | 0336d4e997a0c384b44026935f0e19ad71d27b06 (diff) |
HID: corsair,lenovo: Convert sprintf() family to sysfs_emit() family
Per filesystems/sysfs.rst, show() should only use sysfs_emit()
or sysfs_emit_at() when formatting the value to be returned to user space.
coccinelle complains that there are still a couple of functions that use
snprintf(). Convert them to sysfs_emit().
sprintf() and scnprintf() will be converted as well if they have.
Generally, this patch is generated by
make coccicheck M=<path/to/file> MODE=patch \
COCCI=scripts/coccinelle/api/device_attr_show.cocci
No functional change intended
CC: Jiri Kosina <jikos@kernel.org>
CC: Benjamin Tissoires <benjamin.tissoires@redhat.com>
CC: linux-input@vger.kernel.org
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'drivers/hid/hid-corsair.c')
-rw-r--r-- | drivers/hid/hid-corsair.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hid/hid-corsair.c b/drivers/hid/hid-corsair.c index 8c895c820b67..702f50e9841d 100644 --- a/drivers/hid/hid-corsair.c +++ b/drivers/hid/hid-corsair.c @@ -298,7 +298,7 @@ static ssize_t k90_show_macro_mode(struct device *dev, goto out; } - ret = snprintf(buf, PAGE_SIZE, "%s\n", macro_mode); + ret = sysfs_emit(buf, "%s\n", macro_mode); out: kfree(data); @@ -367,7 +367,7 @@ static ssize_t k90_show_current_profile(struct device *dev, goto out; } - ret = snprintf(buf, PAGE_SIZE, "%d\n", current_profile); + ret = sysfs_emit(buf, "%d\n", current_profile); out: kfree(data); |