diff options
author | Li Zhijian <lizhijian@fujitsu.com> | 2024-03-19 06:45:26 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.com> | 2024-04-03 13:42:04 +0200 |
commit | 0336d4e997a0c384b44026935f0e19ad71d27b06 (patch) | |
tree | 02c2dd03285df70b5bf97b10e3ecdae8803e6b58 /drivers/hid/hid-roccat-isku.c | |
parent | HID: hid-sensor-custom: Convert sprintf() family to sysfs_emit() family (diff) | |
download | linux-0336d4e997a0c384b44026935f0e19ad71d27b06.tar.xz linux-0336d4e997a0c384b44026935f0e19ad71d27b06.zip |
HID: roccat: 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: Stefan Achatz <erazor_de@users.sourceforge.net>
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-roccat-isku.c')
-rw-r--r-- | drivers/hid/hid-roccat-isku.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c index 458060403397..0cd6208fb371 100644 --- a/drivers/hid/hid-roccat-isku.c +++ b/drivers/hid/hid-roccat-isku.c @@ -61,7 +61,7 @@ static ssize_t isku_sysfs_show_actual_profile(struct device *dev, { struct isku_device *isku = hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); - return snprintf(buf, PAGE_SIZE, "%d\n", isku->actual_profile); + return sysfs_emit(buf, "%d\n", isku->actual_profile); } static ssize_t isku_sysfs_set_actual_profile(struct device *dev, |