mm: vmscan: use sysfs_emit() to instead of scnprintf()
authorXu Panda <xu.panda@zte.com.cn>
Thu, 24 Nov 2022 11:29:01 +0000 (19:29 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 30 Nov 2022 23:59:08 +0000 (15:59 -0800)
Replace open-coded snprintf() with sysfs_emit() to simplify the code.

Link: https://lkml.kernel.org/r/202211241929015476424@zte.com.cn
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmscan.c

index 805fa51..9356a3e 100644 (file)
@@ -5407,7 +5407,7 @@ static ssize_t show_enabled(struct kobject *kobj, struct kobj_attribute *attr, c
        if (arch_has_hw_nonleaf_pmd_young() && get_cap(LRU_GEN_NONLEAF_YOUNG))
                caps |= BIT(LRU_GEN_NONLEAF_YOUNG);
 
-       return snprintf(buf, PAGE_SIZE, "0x%04x\n", caps);
+       return sysfs_emit(buf, "0x%04x\n", caps);
 }
 
 /* see Documentation/admin-guide/mm/multigen_lru.rst for details */