sound/soc/fsl/imx-audmux.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
From: XieLudan <xie.ludan@zte.com.cn>
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: XieLudan <xie.ludan@zte.com.cn>
---
sound/soc/fsl/imx-audmux.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index cc2918ee2cf5..6062503d3543 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -77,45 +77,41 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
ret = sysfs_emit(buf, "PDCR: %08x\nPTCR: %08x\n", pdcr, ptcr);
if (ptcr & IMX_AUDMUX_V2_PTCR_TFSDIR)
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
+ ret += sysfs_emit(buf + ret,
"TxFS output from %s, ",
audmux_port_string((ptcr >> 27) & 0x7));
else
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
+ ret += sysfs_emit(buf + ret,
"TxFS input, ");
if (ptcr & IMX_AUDMUX_V2_PTCR_TCLKDIR)
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
+ ret += sysfs_emit(buf + ret,
"TxClk output from %s",
audmux_port_string((ptcr >> 22) & 0x7));
else
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
- "TxClk input");
+ ret += sysfs_emit(buf + ret, "TxClk input");
- ret += scnprintf(buf + ret, PAGE_SIZE - ret, "\n");
+ ret += sysfs_emit(buf + ret, "\n");
if (ptcr & IMX_AUDMUX_V2_PTCR_SYN) {
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
- "Port is symmetric");
+ ret += sysfs_emit(buf + ret, "Port is symmetric");
} else {
if (ptcr & IMX_AUDMUX_V2_PTCR_RFSDIR)
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
+ ret += sysfs_emit(buf + ret,
"RxFS output from %s, ",
audmux_port_string((ptcr >> 17) & 0x7));
else
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
- "RxFS input, ");
+ ret += sysfs_emit(buf + ret, "RxFS input, ");
if (ptcr & IMX_AUDMUX_V2_PTCR_RCLKDIR)
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
+ ret += sysfs_emit(buf + ret,
"RxClk output from %s",
audmux_port_string((ptcr >> 12) & 0x7));
else
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
- "RxClk input");
+ ret += sysfs_emit(buf + ret, "RxClk input");
}
- ret += scnprintf(buf + ret, PAGE_SIZE - ret,
+ ret += sysfs_emit(buf + ret,
"\nData received from %s\n",
audmux_port_string((pdcr >> 13) & 0x7));
--
2.25.1
On 15. 03. 25, 7:15, xie.ludan@zte.com.cn wrote: > From: XieLudan <xie.ludan@zte.com.cn> > > > 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: XieLudan <xie.ludan@zte.com.cn> > > --- > > sound/soc/fsl/imx-audmux.c | 26 +++++++++++--------------- > > 1 file changed, 11 insertions(+), 15 deletions(-) > > > diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c > > index cc2918ee2cf5..6062503d3543 100644 > > --- a/sound/soc/fsl/imx-audmux.c > > +++ b/sound/soc/fsl/imx-audmux.c > > @@ -77,45 +77,41 @@ static ssize_t audmux_read_file(struct file *file, > char __user *user_buf, > > ret = sysfs_emit(buf, "PDCR: %08x\nPTCR: %08x\n", pdcr, ptcr); > > if (ptcr & IMX_AUDMUX_V2_PTCR_TFSDIR) > > -ret += scnprintf(buf + ret, PAGE_SIZE - ret, > > +ret += sysfs_emit(buf + ret, This is wrong too [1]. [1] https://lore.kernel.org/all/9c552d9a-2d46-4069-a9c4-35fab857bfc3@kernel.org/ regards, -- js suse labs
© 2016 - 2025 Red Hat, Inc.