From: XieLudan <xie.lu...@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.lu...@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

Reply via email to