Skip to contentSkip to conversation

perf/core: remove newline char in perf_event_sysfs_show

PATCH In review Madhavan Srinivasan 2 participants 2 messages May 28, 2015 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/core: remove newline char in perf_event_sysfs_show

When a event also carries a event.unit file, having newline char will make perf userspace tool to print the event name in the next line when dumping counter data.

Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Sukadev Bhattiprolu <[email protected]>
Cc Michael Ellerman <[email protected]>
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/core.c +1 -1
index 1a3bf48..3b5a372 100644
@@ -8982,7 +8982,7 @@ ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
 		container_of(attr, struct perf_pmu_events_attr, attr);
 
 	if (pmu_attr->event_str)
-		return sprintf(page, "%s\n", pmu_attr->event_str);
+		return sprintf(page, "%s", pmu_attr->event_str);
 
 	return 0;
 }
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 3 lines · Madhavan Srinivasan

When a event also carries a event.unit file, having newline char will make perf userspace tool to print the event name in the next line when dumping counter data.

And changing the kernel will break the API (it includes a '\n' now) so fix the tool.