]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
perf map: Use map->dso->kernel + map__kmaps() in map__kmaps()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 4 Nov 2019 19:31:33 +0000 (16:31 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 12 Nov 2019 11:20:52 +0000 (08:20 -0300)
Its equivalent to using map->groups to obtain the machine struct.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-bdbazuj4ggrmzxdviaqdrdwh@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/map.c

index 466c9b035e1957c5ca2bcd7a829b289953105d5f..a4d889c0fa88f1cd7e6586400370b09e38b2cfa7 100644 (file)
@@ -244,18 +244,11 @@ struct map *map__new2(u64 start, struct dso *dso)
        return map;
 }
 
-/*
- * Use this and __map__is_kmodule() for map instances that are in
- * machine->kmaps, and thus have map->groups->machine all properly set, to
- * disambiguate between the kernel and modules.
- *
- * When the need arises, introduce map__is_{kernel,kmodule)() that
- * checks (map->groups != NULL && map->groups->machine != NULL &&
- * map->dso->kernel) before calling __map__is_{kernel,kmodule}())
- */
 bool __map__is_kernel(const struct map *map)
 {
-       return machine__kernel_map(map->groups->machine) == map;
+       if (!map->dso->kernel)
+               return false;
+       return machine__kernel_map(map__kmaps((struct map *)map)->machine) == map;
 }
 
 bool __map__is_extra_kernel_map(const struct map *map)