Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf kallsyms: Adopt hex2u64 from tools/perf/util/util.h

Just removing more stuff from tools/perf/, this is mostly used in the
kallsyms parsing and in places in perf where kallsyms is involved, so we
get it for free there.

With this we reduce a bit more util.h.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-5mc1zg0jqdwgkn8c358kaba6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+15 -14
+13
tools/lib/symbol/kallsyms.c
··· 16 16 return symbol_type == 'T' || symbol_type == 'W'; 17 17 } 18 18 19 + /* 20 + * While we find nice hex chars, build a long_val. 21 + * Return number of chars processed. 22 + */ 23 + int hex2u64(const char *ptr, u64 *long_val) 24 + { 25 + char *p; 26 + 27 + *long_val = strtoull(ptr, &p, 16); 28 + 29 + return p - ptr; 30 + } 31 + 19 32 int kallsyms__parse(const char *filename, void *arg, 20 33 int (*process_symbol)(void *arg, const char *name, 21 34 char type, u64 start))
+2
tools/lib/symbol/kallsyms.h
··· 18 18 return isupper(type) ? STB_GLOBAL : STB_LOCAL; 19 19 } 20 20 21 + int hex2u64(const char *ptr, u64 *long_val); 22 + 21 23 u8 kallsyms2elf_type(char type); 22 24 23 25 bool kallsyms__is_function(char symbol_type);
-13
tools/perf/util/util.c
··· 434 434 return n; 435 435 } 436 436 437 - /* 438 - * While we find nice hex chars, build a long_val. 439 - * Return number of chars processed. 440 - */ 441 - int hex2u64(const char *ptr, u64 *long_val) 442 - { 443 - char *p; 444 - 445 - *long_val = strtoull(ptr, &p, 16); 446 - 447 - return p - ptr; 448 - } 449 - 450 437 int perf_event_paranoid(void) 451 438 { 452 439 int value;
-1
tools/perf/util/util.h
··· 43 43 ssize_t writen(int fd, const void *buf, size_t n); 44 44 45 45 size_t hex_width(u64 v); 46 - int hex2u64(const char *ptr, u64 *val); 47 46 48 47 extern unsigned int page_size; 49 48 int __pure cacheline_size(void);