remoteproc: debugfs: Replace scnprintf() with sysfs_emit()
PATCH 1/1 remoteproc: debugfs: Replace scnprintf() with sysfs_emit()
Convert the debugfs show() functions in remoteproc_debugfs.c to use sysfs_emit() instead of scnprintf(). The sysfs_emit() helper is the preferred way to format sysfs output as it ensures the output is properly bounded to PAGE_SIZE and simplifies the code.
This patch addresses three instances of scnprintf() usage in the file.
Signed-off-by Abhinav Ananthu <[email protected]>
--- drivers/remoteproc/remoteproc_debugfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/remoteproc/remoteproc_debugfs.c +5 -4
@@ -46,8 +46,9 @@ static ssize_t rproc_coredump_read(struct file *filp, char __user *userbuf,char buf[20 ];int len; - len =scnprintf (buf,sizeof (buf),"%s\n" , - rproc_coredump_str[rproc->dump_conf]); + len =sysfs_emit (buf,"%s\n" , + rproc_coredump_str[rproc->dump_conf]); +return simple_read_from_buffer (userbuf, count, ppos, buf, len); }
@@ -135,7 +136,7 @@ static ssize_t rproc_trace_read(struct file *filp, char __user *userbuf, va =rproc_da_to_va (data->rproc, trace->da, trace->len,NULL );if (!va) { - len =scnprintf (buf,sizeof (buf),"Trace %s not available\n" , + len =sysfs_emit (buf,"Trace %s not available\n" , trace->name); va = buf; }else {
@@ -160,7 +161,7 @@ static ssize_t rproc_name_read(struct file *filp, char __user *userbuf,char buf[100 ];int i; - i =scnprintf (buf,sizeof (buf),"%.98s\n" , rproc->name); + i =sysfs_emit (buf,"%.98s\n" , rproc->name);return simple_read_from_buffer (userbuf, count, ppos, buf, i); }
Signature · 1 line
2.34.1