summaryrefslogtreecommitdiff
path: root/drivers/usb/core/ledtrig-usbport.c
diff options
context:
space:
mode:
authorJiayi Li <lijiayi@kylinos.cn>2024-10-23 16:54:29 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-29 04:33:49 +0100
commitc67e9601e29a636a14626707a7b2e5832ba71a75 (patch)
tree3acd54834fc87cc2dcadf5c842e89b233e275a33 /drivers/usb/core/ledtrig-usbport.c
parent33a0302455d664f18a4a65fd5a9997c0cef6bd39 (diff)
usb: core: 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: Jiayi Li <lijiayi@kylinos.cn> Link: https://lore.kernel.org/r/20241023085429.2865488-1-lijiayi@kylinos.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/ledtrig-usbport.c')
-rw-r--r--drivers/usb/core/ledtrig-usbport.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/core/ledtrig-usbport.c b/drivers/usb/core/ledtrig-usbport.c
index 85c999f71ad7..5e3c515991f3 100644
--- a/drivers/usb/core/ledtrig-usbport.c
+++ b/drivers/usb/core/ledtrig-usbport.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/usb.h>
#include <linux/usb/of.h>
@@ -87,7 +88,7 @@ static ssize_t usbport_trig_port_show(struct device *dev,
struct usbport_trig_port,
attr);
- return sprintf(buf, "%d\n", port->observed) + 1;
+ return sysfs_emit(buf, "%d\n", port->observed) + 1;
}
static ssize_t usbport_trig_port_store(struct device *dev,