Re: [RESEND PATCH 1/2] PM: hibernate: Use sysfs_emit() and sysfs_emit_at() in "show" functions

From: Christophe JAILLET
Date: Tue Jul 30 2024 - 12:18:25 EST


Le 30/07/2024 à 08:54, Xueqin Luo a écrit :
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: Xueqin Luo <luoxueqin@xxxxxxxxxx>
---

Hi,
...

@@ -1210,7 +1210,7 @@ power_attr(disk);
static ssize_t resume_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{
- return sprintf(buf, "%d:%d\n", MAJOR(swsusp_resume_device),
+ return sysfs_emit(buf, "%d:%d\n", MAJOR(swsusp_resume_device),
MINOR(swsusp_resume_device));

Nitpick: now the alignment with the '(' is not correct anymore.

}

...

CJ