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

objtool: Collate parse_options() users

Ensure there's a single place that parses check_options, in
preparation for extending where to get options from.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20210226110004.193108106@infradead.org

authored by

Peter Zijlstra and committed by
Ingo Molnar
a2f605f9 8ad15c69

+12 -9
+9 -5
tools/objtool/builtin-check.c
··· 42 42 OPT_END(), 43 43 }; 44 44 45 + int cmd_parse_options(int argc, const char **argv, const char * const usage[]) 46 + { 47 + argc = parse_options(argc, argv, check_options, usage, 0); 48 + if (argc != 1) 49 + usage_with_options(usage, check_options); 50 + return argc; 51 + } 52 + 45 53 int cmd_check(int argc, const char **argv) 46 54 { 47 55 const char *objname; 48 56 struct objtool_file *file; 49 57 int ret; 50 58 51 - argc = parse_options(argc, argv, check_options, check_usage, 0); 52 - 53 - if (argc != 1) 54 - usage_with_options(check_usage, check_options); 55 - 59 + argc = cmd_parse_options(argc, argv, check_usage); 56 60 objname = argv[0]; 57 61 58 62 file = objtool_open_read(objname);
+1 -4
tools/objtool/builtin-orc.c
··· 34 34 struct objtool_file *file; 35 35 int ret; 36 36 37 - argc = parse_options(argc, argv, check_options, orc_usage, 0); 38 - if (argc != 1) 39 - usage_with_options(orc_usage, check_options); 40 - 37 + argc = cmd_parse_options(argc, argv, orc_usage); 41 38 objname = argv[0]; 42 39 43 40 file = objtool_open_read(objname);
+2
tools/objtool/include/objtool/builtin.h
··· 11 11 extern bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, 12 12 validate_dup, vmlinux, mcount, noinstr, backup; 13 13 14 + extern int cmd_parse_options(int argc, const char **argv, const char * const usage[]); 15 + 14 16 extern int cmd_check(int argc, const char **argv); 15 17 extern int cmd_orc(int argc, const char **argv); 16 18