]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf pmu: perf_cpu_map__new_int to avoid parsing a string
authorIan Rogers <irogers@google.com>
Thu, 13 Nov 2025 18:05:08 +0000 (10:05 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Tue, 18 Nov 2025 02:43:08 +0000 (18:43 -0800)
Prefer perf_cpu_map__new_int(0) to perf_cpu_map__new("0") as it avoids
strings parsing.

Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/drm_pmu.c
tools/perf/util/hwmon_pmu.c

index b3052266d59937aa4b6b5c58954c2220dd86c85b..b48a375e45843d1ce6961ebdd249631823f71570 100644 (file)
@@ -120,7 +120,7 @@ static struct drm_pmu *add_drm_pmu(struct list_head *pmus, char *line, size_t li
                return NULL;
        }
 
-       drm->pmu.cpus = perf_cpu_map__new("0");
+       drm->pmu.cpus = perf_cpu_map__new_int(0);
        if (!drm->pmu.cpus) {
                perf_pmu__delete(&drm->pmu);
                return NULL;
index 5c27256a220a51828d4647a2f662c9493af91b04..279d6b1a47f03c77715c6e1971a06857a411a528 100644 (file)
@@ -376,7 +376,7 @@ struct perf_pmu *hwmon_pmu__new(struct list_head *pmus, const char *hwmon_dir,
                perf_pmu__delete(&hwm->pmu);
                return NULL;
        }
-       hwm->pmu.cpus = perf_cpu_map__new("0");
+       hwm->pmu.cpus = perf_cpu_map__new_int(0);
        if (!hwm->pmu.cpus) {
                perf_pmu__delete(&hwm->pmu);
                return NULL;