From: Arnaldo Carvalho de Melo Date: Tue, 27 Jun 2017 13:59:28 +0000 (-0300) Subject: perf help: Elliminate dup code for reporting X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=86e474ff870aded90c4ffa3f488cb5c093188ca4;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git perf help: Elliminate dup code for reporting And switch from warning() to pr_warning(), to elliminate another duplication: too many error reporting facilities. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-pkzcjrhek3uuqc4i5i9ealwd@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index e82fa0d5866e..ff53e9800b8b 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c @@ -210,6 +210,12 @@ static void do_add_man_viewer_info(const char *name, man_viewer_info_list = new; } +static void unsupported_man_viewer(const char *name, const char *var) +{ + pr_warning("'%s': path for unsupported man viewer.\n" + "Please consider using 'man..%s' instead.", name, var); +} + static int add_man_viewer_path(const char *name, size_t len, const char *value) @@ -217,9 +223,7 @@ static int add_man_viewer_path(const char *name, if (supported_man_viewer(name, len)) do_add_man_viewer_info(name, len, value); else - warning("'%s': path for unsupported man viewer.\n" - "Please consider using 'man..cmd' instead.", - name); + unsupported_man_viewer(name, "cmd"); return 0; } @@ -229,9 +233,7 @@ static int add_man_viewer_cmd(const char *name, const char *value) { if (supported_man_viewer(name, len)) - warning("'%s': cmd for supported man viewer.\n" - "Please consider using 'man..path' instead.", - name); + unsupported_man_viewer(name, "path"); else do_add_man_viewer_info(name, len, value);