Thread (1 message) 1 message, 1 author, 2025-03-17

Re: [PATCH linux-next] ASoC: use sysfs_emit() instead of scnprintf().

From: Jiri Slaby <jirislaby@kernel.org>
Date: 2025-03-17 06:21:29
Also in: imx, linux-arm-kernel, linux-sound, lkml

On 15. 03. 25, 7:15, xie.ludan@zte.com.cn wrote:
quoted hunk
From: XieLudan <redacted>


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 <redacted>

---

  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/ (local)

regards,
-- 
js
suse labs

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help