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

Configure Feed

Select the types of activity you want to include in your feed.

kconfig: add sym_get_prompt_menu() helper function

Split out the code that retrieves the menu entry with a prompt, so it
can be reused in other functions.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+20 -7
+1
scripts/kconfig/lkc_proto.h
··· 34 34 bool sym_string_within_range(struct symbol *sym, const char *str); 35 35 bool sym_set_string_value(struct symbol *sym, const char *newval); 36 36 bool sym_is_changeable(const struct symbol *sym); 37 + struct menu *sym_get_prompt_menu(const struct symbol *sym); 37 38 struct menu *sym_get_choice_menu(const struct symbol *sym); 38 39 const char * sym_get_string_value(struct symbol *sym); 39 40
+19 -7
scripts/kconfig/symbol.c
··· 71 71 } 72 72 73 73 /** 74 + * sym_get_prompt_menu - get the menu entry with a prompt 75 + * 76 + * @sym: a symbol pointer 77 + * 78 + * Return: the menu entry with a prompt. 79 + */ 80 + struct menu *sym_get_prompt_menu(const struct symbol *sym) 81 + { 82 + struct menu *m; 83 + 84 + list_for_each_entry(m, &sym->menus, link) 85 + if (m->prompt) 86 + return m; 87 + 88 + return NULL; 89 + } 90 + 91 + /** 74 92 * sym_get_choice_menu - get the parent choice menu if present 75 93 * 76 94 * @sym: a symbol pointer ··· 98 80 struct menu *sym_get_choice_menu(const struct symbol *sym) 99 81 { 100 82 struct menu *menu = NULL; 101 - struct menu *m; 102 83 103 84 /* 104 85 * Choice members must have a prompt. Find a menu entry with a prompt, 105 86 * and assume it resides inside a choice block. 106 87 */ 107 - list_for_each_entry(m, &sym->menus, link) 108 - if (m->prompt) { 109 - menu = m; 110 - break; 111 - } 112 - 88 + menu = sym_get_prompt_menu(sym); 113 89 if (!menu) 114 90 return NULL; 115 91