]> Git Repo - J-linux.git/blobdiff - drivers/perf/arm-ccn.c
Merge tag 'linux-kselftest-next-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kerne...
[J-linux.git] / drivers / perf / arm-ccn.c
index a0a71c1df042abf25ff8935aa95ca80f7a1565bf..96d47cb302dd1001d907ee9773116a07243d4ae9 100644 (file)
@@ -221,7 +221,7 @@ static ssize_t arm_ccn_pmu_format_show(struct device *dev,
        struct dev_ext_attribute *ea = container_of(attr,
                        struct dev_ext_attribute, attr);
 
-       return snprintf(buf, PAGE_SIZE, "%s\n", (char *)ea->var);
+       return sysfs_emit(buf, "%s\n", (char *)ea->var);
 }
 
 #define CCN_FORMAT_ATTR(_name, _config) \
@@ -326,43 +326,38 @@ static ssize_t arm_ccn_pmu_event_show(struct device *dev,
        struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev));
        struct arm_ccn_pmu_event *event = container_of(attr,
                        struct arm_ccn_pmu_event, attr);
-       ssize_t res;
+       int 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",
-                               event->event);
+               res += sysfs_emit_at(buf, 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, ",%s", event->def);
        if (event->mask)
-               res += scnprintf(buf + res, PAGE_SIZE - res, ",mask=0x%x",
-                               event->mask);
+               res += sysfs_emit_at(buf, 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_at(buf, res, ",xp=?,vc=?");
                if (event->event == CCN_EVENT_WATCHPOINT)
-                       res += scnprintf(buf + res, PAGE_SIZE - res,
+                       res += sysfs_emit_at(buf, res,
                                        ",port=?,dir=?,cmp_l=?,cmp_h=?,mask=?");
                else
-                       res += scnprintf(buf + res, PAGE_SIZE - res,
-                                       ",bus=?");
+                       res += sysfs_emit_at(buf, 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, ",node=%d", ccn->mn_id);
                break;
        default:
-               res += scnprintf(buf + res, PAGE_SIZE - res, ",node=?");
+               res += sysfs_emit_at(buf, res, ",node=?");
                break;
        }
 
-       res += scnprintf(buf + res, PAGE_SIZE - res, "\n");
+       res += sysfs_emit_at(buf, res, "\n");
 
        return res;
 }
@@ -476,7 +471,7 @@ static ssize_t arm_ccn_pmu_cmp_mask_show(struct device *dev,
        struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev));
        u64 *mask = arm_ccn_pmu_get_cmp_mask(ccn, attr->attr.name);
 
-       return mask ? snprintf(buf, PAGE_SIZE, "0x%016llx\n", *mask) : -EINVAL;
+       return mask ? sysfs_emit(buf, "0x%016llx\n", *mask) : -EINVAL;
 }
 
 static ssize_t arm_ccn_pmu_cmp_mask_store(struct device *dev,
This page took 0.032634 seconds and 4 git commands to generate.