Skip to content
Permalink
Browse files
drivers/perf: convert sysfs scnprintf family to sysfs_emit_at
Use the generic sysfs_emit_at() function take place of scnprintf()

Signed-off-by: Qi Liu <liuqi115@huawei.com>
  • Loading branch information
77liuqi authored and intel-lab-lkp committed Mar 17, 2021
1 parent e7dbc9e commit 81a69a2f7fa73d0c41d699d6c6993c2594001241
Showing 1 changed file with 10 additions and 14 deletions.
@@ -328,41 +328,37 @@ static ssize_t arm_ccn_pmu_event_show(struct device *dev,
struct arm_ccn_pmu_event, attr);
ssize_t res;

res = scnprintf(buf, PAGE_SIZE, "type=0x%x", event->type);
res = sysfs_emit(buf, "type=0x%x", event->type);
if (event->event)
res += scnprintf(buf + res, PAGE_SIZE - res, ",event=0x%x",
res += sysfs_emit_at(buf + res, res, ",event=0x%x",
event->event);
if (event->def)
res += scnprintf(buf + res, PAGE_SIZE - res, ",%s",
event->def);
res += sysfs_emit_at(buf + res, res, ",%s", event->def);
if (event->mask)
res += scnprintf(buf + res, PAGE_SIZE - res, ",mask=0x%x",
event->mask);
res += sysfs_emit_at(buf + res, res, ",mask=0x%x", event->mask);

/* Arguments required by an event */
switch (event->type) {
case CCN_TYPE_CYCLES:
break;
case CCN_TYPE_XP:
res += scnprintf(buf + res, PAGE_SIZE - res,
",xp=?,vc=?");
res += sysfs_emit(buf + res, res, ",xp=?,vc=?");
if (event->event == CCN_EVENT_WATCHPOINT)
res += scnprintf(buf + res, PAGE_SIZE - res,
res += sysfs_emit_at(buf + res, res,
",port=?,dir=?,cmp_l=?,cmp_h=?,mask=?");
else
res += scnprintf(buf + res, PAGE_SIZE - res,
",bus=?");
res += sysfs_emit_at(buf + res, res, ",bus=?");

break;
case CCN_TYPE_MN:
res += scnprintf(buf + res, PAGE_SIZE - res, ",node=%d", ccn->mn_id);
res += sysfs_emit_at(buf + res, res, ",node=%d", ccn->mn_id);
break;
default:
res += scnprintf(buf + res, PAGE_SIZE - res, ",node=?");
res += sysfs_emit_at(buf + res, res, ",node=?");
break;
}

res += scnprintf(buf + res, PAGE_SIZE - res, "\n");
res += sysfs_emit_at(buf + res, res, "\n");

return res;
}

0 comments on commit 81a69a2

Please sign in to comment.