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 <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: http://lkml.kernel.org/n/tip-pkzcjrhek3uuqc4i5i9ealwd@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 881c362d
...@@ -210,6 +210,12 @@ static void do_add_man_viewer_info(const char *name, ...@@ -210,6 +210,12 @@ static void do_add_man_viewer_info(const char *name,
man_viewer_info_list = new; 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.<tool>.%s' instead.", name, var);
}
static int add_man_viewer_path(const char *name, static int add_man_viewer_path(const char *name,
size_t len, size_t len,
const char *value) const char *value)
...@@ -217,9 +223,7 @@ static int add_man_viewer_path(const char *name, ...@@ -217,9 +223,7 @@ static int add_man_viewer_path(const char *name,
if (supported_man_viewer(name, len)) if (supported_man_viewer(name, len))
do_add_man_viewer_info(name, len, value); do_add_man_viewer_info(name, len, value);
else else
warning("'%s': path for unsupported man viewer.\n" unsupported_man_viewer(name, "cmd");
"Please consider using 'man.<tool>.cmd' instead.",
name);
return 0; return 0;
} }
...@@ -229,9 +233,7 @@ static int add_man_viewer_cmd(const char *name, ...@@ -229,9 +233,7 @@ static int add_man_viewer_cmd(const char *name,
const char *value) const char *value)
{ {
if (supported_man_viewer(name, len)) if (supported_man_viewer(name, len))
warning("'%s': cmd for supported man viewer.\n" unsupported_man_viewer(name, "path");
"Please consider using 'man.<tool>.path' instead.",
name);
else else
do_add_man_viewer_info(name, len, value); do_add_man_viewer_info(name, len, value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment