Skip to content

Commit b6ecb57

Browse files
XieLudanIngo Molnar
authored andcommitted
perf/core: Use sysfs_emit() instead of scnprintf()
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." No change in functionality intended. [ mingo: Updated the changelog ] Signed-off-by: XieLudan <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent fd3f5d3 commit b6ecb57

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/events/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11713,7 +11713,7 @@ static ssize_t nr_addr_filters_show(struct device *dev,
1171311713
{
1171411714
struct pmu *pmu = dev_get_drvdata(dev);
1171511715

11716-
return scnprintf(page, PAGE_SIZE - 1, "%d\n", pmu->nr_addr_filters);
11716+
return sysfs_emit(page, "%d\n", pmu->nr_addr_filters);
1171711717
}
1171811718
DEVICE_ATTR_RO(nr_addr_filters);
1171911719

@@ -11724,7 +11724,7 @@ type_show(struct device *dev, struct device_attribute *attr, char *page)
1172411724
{
1172511725
struct pmu *pmu = dev_get_drvdata(dev);
1172611726

11727-
return scnprintf(page, PAGE_SIZE - 1, "%d\n", pmu->type);
11727+
return sysfs_emit(page, "%d\n", pmu->type);
1172811728
}
1172911729
static DEVICE_ATTR_RO(type);
1173011730

@@ -11735,7 +11735,7 @@ perf_event_mux_interval_ms_show(struct device *dev,
1173511735
{
1173611736
struct pmu *pmu = dev_get_drvdata(dev);
1173711737

11738-
return scnprintf(page, PAGE_SIZE - 1, "%d\n", pmu->hrtimer_interval_ms);
11738+
return sysfs_emit(page, "%d\n", pmu->hrtimer_interval_ms);
1173911739
}
1174011740

1174111741
static DEFINE_MUTEX(mux_interval_mutex);

0 commit comments

Comments
 (0)