mirror of
https://github.com/torvalds/linux
synced 2024-09-19 10:39:01 +00:00
kernel/cpu: Convert snprintf() to sysfs_emit()
Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). No functional change intended. Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240116045151.3940401-40-lizhijian@fujitsu.com
This commit is contained in:
parent
ef7e585bf4
commit
effe6d278e
|
@ -3004,7 +3004,7 @@ static ssize_t control_show(struct device *dev,
|
||||||
return sysfs_emit(buf, "%d\n", cpu_smt_num_threads);
|
return sysfs_emit(buf, "%d\n", cpu_smt_num_threads);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE - 2, "%s\n", state);
|
return sysfs_emit(buf, "%s\n", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t control_store(struct device *dev, struct device_attribute *attr,
|
static ssize_t control_store(struct device *dev, struct device_attribute *attr,
|
||||||
|
@ -3017,7 +3017,7 @@ static DEVICE_ATTR_RW(control);
|
||||||
static ssize_t active_show(struct device *dev,
|
static ssize_t active_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return snprintf(buf, PAGE_SIZE - 2, "%d\n", sched_smt_active());
|
return sysfs_emit(buf, "%d\n", sched_smt_active());
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(active);
|
static DEVICE_ATTR_RO(active);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue