Skip to content

Commit abe5449

Browse files
committed
perf map: Shorten map_groups__find() signature
Removing the map_type, that is going away. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-18iiiw25r75xn7zlppjldk48@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent d05b861 commit abe5449

9 files changed

Lines changed: 16 additions & 13 deletions

File tree

‎tools/perf/arch/arm/tests/dwarf-unwind.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static int sample_ustack(struct perf_sample *sample,
2525

2626
sp = (unsigned long) regs[PERF_REG_ARM_SP];
2727

28-
map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
28+
map = __map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
2929
if (!map) {
3030
pr_debug("failed to get stack map\n");
3131
free(buf);

‎tools/perf/arch/arm64/tests/dwarf-unwind.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static int sample_ustack(struct perf_sample *sample,
2525

2626
sp = (unsigned long) regs[PERF_REG_ARM64_SP];
2727

28-
map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
28+
map = __map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
2929
if (!map) {
3030
pr_debug("failed to get stack map\n");
3131
free(buf);

‎tools/perf/arch/powerpc/tests/dwarf-unwind.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
2626

2727
sp = (unsigned long) regs[PERF_REG_POWERPC_R1];
2828

29-
map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
29+
map = __map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
3030
if (!map) {
3131
pr_debug("failed to get stack map\n");
3232
free(buf);

‎tools/perf/arch/x86/tests/dwarf-unwind.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
2626

2727
sp = (unsigned long) regs[PERF_REG_X86_SP];
2828

29-
map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
29+
map = __map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
3030
if (!map) {
3131
pr_debug("failed to get stack map\n");
3232
free(buf);

‎tools/perf/tests/vmlinux-kallsyms.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtest
1919
struct symbol *sym;
2020
struct map *kallsyms_map, *vmlinux_map, *map;
2121
struct machine kallsyms, vmlinux;
22-
enum map_type type = MAP__FUNCTION;
2322
struct maps *maps = machine__kernel_maps(&vmlinux);
2423
u64 mem_start, mem_end;
2524
bool header_printed;
@@ -205,7 +204,7 @@ int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtest
205204
mem_start = vmlinux_map->unmap_ip(vmlinux_map, map->start);
206205
mem_end = vmlinux_map->unmap_ip(vmlinux_map, map->end);
207206

208-
pair = map_groups__find(&kallsyms.kmaps, type, mem_start);
207+
pair = map_groups__find(&kallsyms.kmaps, mem_start);
209208
if (pair == NULL || pair->priv)
210209
continue;
211210

‎tools/perf/util/event.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ struct map *__thread__find_map(struct thread *thread, u8 cpumode, enum map_type
15341534
return NULL;
15351535
}
15361536
try_again:
1537-
al->map = map_groups__find(mg, type, al->addr);
1537+
al->map = __map_groups__find(mg, type, al->addr);
15381538
if (al->map == NULL) {
15391539
/*
15401540
* If this is outside of all known maps, and is a negative

‎tools/perf/util/map.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg,
574574
enum map_type type, u64 addr,
575575
struct map **mapp)
576576
{
577-
struct map *map = map_groups__find(mg, type, addr);
577+
struct map *map = __map_groups__find(mg, type, addr);
578578

579579
/* Ensure map is loaded before using map->map_ip */
580580
if (map != NULL && map__load(map) >= 0) {
@@ -627,8 +627,7 @@ int map_groups__find_ams(struct addr_map_symbol *ams)
627627
if (ams->addr < ams->map->start || ams->addr >= ams->map->end) {
628628
if (ams->map->groups == NULL)
629629
return -1;
630-
ams->map = map_groups__find(ams->map->groups, ams->map->type,
631-
ams->addr);
630+
ams->map = __map_groups__find(ams->map->groups, ams->map->type, ams->addr);
632631
if (ams->map == NULL)
633632
return -1;
634633
}

‎tools/perf/util/map.h‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,17 @@ static inline void map_groups__remove(struct map_groups *mg, struct map *map)
214214
maps__remove(&mg->maps[map->type], map);
215215
}
216216

217-
static inline struct map *map_groups__find(struct map_groups *mg,
218-
enum map_type type, u64 addr)
217+
static inline struct map *__map_groups__find(struct map_groups *mg,
218+
enum map_type type, u64 addr)
219219
{
220220
return maps__find(&mg->maps[type], addr);
221221
}
222222

223+
static inline struct map *map_groups__find(struct map_groups *mg, u64 addr)
224+
{
225+
return __map_groups__find(mg, MAP__FUNCTION, addr);
226+
}
227+
223228
static inline struct map *map_groups__first(struct map_groups *mg,
224229
enum map_type type)
225230
{

‎tools/perf/util/symbol.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map)
723723
if (module)
724724
*module = '\0';
725725

726-
curr_map = map_groups__find(kmaps, map->type, pos->start);
726+
curr_map = __map_groups__find(kmaps, map->type, pos->start);
727727

728728
if (!curr_map) {
729729
symbol__delete(pos);

0 commit comments

Comments
 (0)