Skip to content

Commit bcdedcc

Browse files
wengmeilingtorvalds
authored andcommitted
menuconfig: print more info for symbol without prompts
When we search a config symbol, if it has no prompt the position of this symbol in the Kconfig file and it's dependencies are not printed. This can be inconvenient, especially when it's set to n and we want to find out why. the following is an example: before: Symbol: GENERIC_SMP_IDLE_THREAD [=y] Type : boolean Selected by: X86 [=y] after: Symbol: GENERIC_SMP_IDLE_THREAD [=y] Type : boolean Defined at arch/Kconfig:213 Selected by: X86 [=y] Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com> Signed-off-by: Libo Chen <libo.chen@huawei.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 657a520 commit bcdedcc

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

‎scripts/kconfig/menu.c‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -515,13 +515,6 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
515515
struct jump_key *jump;
516516

517517
str_printf(r, _("Prompt: %s\n"), _(prop->text));
518-
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
519-
prop->menu->lineno);
520-
if (!expr_is_yes(prop->visible.expr)) {
521-
str_append(r, _(" Depends on: "));
522-
expr_gstr_print(prop->visible.expr, r);
523-
str_append(r, "\n");
524-
}
525518
menu = prop->menu->parent;
526519
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
527520
bool accessible = menu_is_visible(menu);
@@ -571,6 +564,18 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
571564
}
572565
}
573566

567+
/*
568+
* get peoperty of type P_SYMBOL
569+
*/
570+
static struct property *get_symbol_prop(struct symbol *sym)
571+
{
572+
struct property *prop = NULL;
573+
574+
for_all_properties(sym, prop, P_SYMBOL)
575+
break;
576+
return prop;
577+
}
578+
574579
/*
575580
* head is optional and may be NULL
576581
*/
@@ -595,6 +600,14 @@ void get_symbol_str(struct gstr *r, struct symbol *sym,
595600
}
596601
for_all_prompts(sym, prop)
597602
get_prompt_str(r, prop, head);
603+
prop = get_symbol_prop(sym);
604+
str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
605+
prop->menu->lineno);
606+
if (!expr_is_yes(prop->visible.expr)) {
607+
str_append(r, _(" Depends on: "));
608+
expr_gstr_print(prop->visible.expr, r);
609+
str_append(r, "\n");
610+
}
598611
hit = false;
599612
for_all_properties(sym, prop, P_SELECT) {
600613
if (!hit) {

0 commit comments

Comments
 (0)