[PATCH] LoongArch: replace sprintf() with sysfs_emit()

cuitao posted 1 patch 1 month ago
arch/loongarch/kernel/env.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] LoongArch: replace sprintf() with sysfs_emit()
Posted by cuitao 1 month ago
As Documentation/filesystems/sysfs.rst suggested, show() should only use
sysfs_emit() or sysfs_emit_at() when formatting the value to be returned
to user space.

No functional change intended.

Signed-off-by: cuitao <cuitao@kylinos.cn>
---
 arch/loongarch/kernel/env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/loongarch/kernel/env.c b/arch/loongarch/kernel/env.c
index c0a5dc9aeae2..19e30206b6e7 100644
--- a/arch/loongarch/kernel/env.c
+++ b/arch/loongarch/kernel/env.c
@@ -86,7 +86,7 @@ late_initcall(fdt_cpu_clk_init);
 static ssize_t boardinfo_show(struct kobject *kobj,
 			      struct kobj_attribute *attr, char *buf)
 {
-	return sprintf(buf,
+	return sysfs_emit(buf,
 		"BIOS Information\n"
 		"Vendor\t\t\t: %s\n"
 		"Version\t\t\t: %s\n"
-- 
2.33.0
Re: [PATCH] LoongArch: replace sprintf() with sysfs_emit()
Posted by Huacai Chen 1 month ago
Queued, thanks.

Huacai

On Tue, Sep 2, 2025 at 5:04 PM cuitao <cuitao@kylinos.cn> wrote:
>
> As Documentation/filesystems/sysfs.rst suggested, show() should only use
> sysfs_emit() or sysfs_emit_at() when formatting the value to be returned
> to user space.
>
> No functional change intended.
>
> Signed-off-by: cuitao <cuitao@kylinos.cn>
> ---
>  arch/loongarch/kernel/env.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/kernel/env.c b/arch/loongarch/kernel/env.c
> index c0a5dc9aeae2..19e30206b6e7 100644
> --- a/arch/loongarch/kernel/env.c
> +++ b/arch/loongarch/kernel/env.c
> @@ -86,7 +86,7 @@ late_initcall(fdt_cpu_clk_init);
>  static ssize_t boardinfo_show(struct kobject *kobj,
>                               struct kobj_attribute *attr, char *buf)
>  {
> -       return sprintf(buf,
> +       return sysfs_emit(buf,
>                 "BIOS Information\n"
>                 "Vendor\t\t\t: %s\n"
>                 "Version\t\t\t: %s\n"
> --
> 2.33.0
>
>