[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3aae62de-1a34-4c5a-9886-64a3e3ce12a4@kernel.org>
Date: Mon, 17 Mar 2025 07:26:51 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: xie.ludan@....com.cn, akpm@...ux-foundation.org
Cc: jbaron@...mai.com, jim.cromie@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dyndbg: use sysfs_emit() instead of scnprintf()
On 17. 03. 25, 3:03, xie.ludan@....com.cn wrote:
> From: XieLudan <xie.ludan@....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@....com.cn>
> ---
> lib/dynamic_debug.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index 5a007952f7f2..83ce3f310ab9 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -795,11 +795,11 @@ int param_get_dyndbg_classes(char *buffer, const struct kernel_param *kp)
>
> case DD_CLASS_TYPE_DISJOINT_NAMES:
> case DD_CLASS_TYPE_DISJOINT_BITS:
> - return scnprintf(buffer, PAGE_SIZE, "0x%lx\n", *dcp->bits);
> + return sysfs_emit(buffer, "0x%lx\n", *dcp->bits);
>
> case DD_CLASS_TYPE_LEVEL_NAMES:
> case DD_CLASS_TYPE_LEVEL_NUM:
> - return scnprintf(buffer, PAGE_SIZE, "%d\n", *dcp->lvl);
> + return sysfs_emit(buffer, "%d\n", *dcp->lvl);
Is this a sysfs callback at all?
--
js
suse labs
Powered by blists - more mailing lists