platform/chrome: wilco_ec: use sysfs_emit() instead of sprintf()

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: Ai Chao <aichao@kylinos.cn>
Link: https://lore.kernel.org/r/20240314052828.186924-1-aichao@kylinos.cn
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
This commit is contained in:
Ai Chao 2024-03-14 13:28:28 +08:00 committed by Tzung-Bi Shih
parent 0bbac3facb
commit 48e49af710

View File

@ -192,7 +192,7 @@ static ssize_t usb_charge_show(struct device *dev,
if (ret < 0)
return ret;
return sprintf(buf, "%d\n", rs.val);
return sysfs_emit(buf, "%d\n", rs.val);
}
static ssize_t usb_charge_store(struct device *dev,