mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 05:44:45 +01:00
w1: core: 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: zhangheng <zhangheng@kylinos.cn> Link: https://lore.kernel.org/r/20241220102337.295864-1-zhangheng@kylinos.cn Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
This commit is contained in:
parent
0f28374e99
commit
419a40cc2b
1 changed files with 2 additions and 2 deletions
|
|
@ -583,7 +583,7 @@ static ssize_t speed_show(struct device *dev, struct device_attribute *attr,
|
|||
return result;
|
||||
|
||||
/* Return current speed value. */
|
||||
return sprintf(buf, "%d\n", result);
|
||||
return sysfs_emit(buf, "%d\n", result);
|
||||
}
|
||||
|
||||
static ssize_t speed_store(struct device *dev, struct device_attribute *attr,
|
||||
|
|
@ -633,7 +633,7 @@ static ssize_t stretch_show(struct device *dev, struct device_attribute *attr,
|
|||
struct w1_f19_data *data = sl->family_data;
|
||||
|
||||
/* Return current stretch value. */
|
||||
return sprintf(buf, "%d\n", data->stretch);
|
||||
return sysfs_emit(buf, "%d\n", data->stretch);
|
||||
}
|
||||
|
||||
static ssize_t stretch_store(struct device *dev, struct device_attribute *attr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue