* [PATCH] kconfig: Print reverse dependencies in groups
@ 2018-02-21 5:44 Masahiro Yamada
2018-02-21 11:10 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2018-02-21 5:44 UTC (permalink / raw)
To: linux-kbuild
Cc: Sam Ravnborg, Ulf Magnusson, Eugeniu Rosca, Petr Vorel,
Masahiro Yamada, Luis R. Rodriguez, Randy Dunlap, linux-kernel,
Nicolas Pitre
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
This patch requires the following as a pre-requisite:
https://patchwork.kernel.org/patch/10229545/
These two will work equivalently to the following three:
https://patchwork.kernel.org/patch/10226951/
https://patchwork.kernel.org/patch/10226953/
https://patchwork.kernel.org/patch/10226955/
scripts/kconfig/expr.c | 18 ++++++++++++------
scripts/kconfig/expr.h | 3 ++-
| 10 ++++++----
3 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index cd3a8f5..49376e1 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1323,19 +1323,25 @@ void expr_gstr_print(struct expr *e, struct gstr *gs)
*/
static void expr_print_revdep(struct expr *e,
void (*fn)(void *, struct symbol *, const char *),
- void *data)
+ void *data, tristate pr_type, const char **title)
{
if (e->type == E_OR) {
- expr_print_revdep(e->left.expr, fn, data);
- expr_print_revdep(e->right.expr, fn, data);
- } else {
+ expr_print_revdep(e->left.expr, fn, data, pr_type, title);
+ expr_print_revdep(e->right.expr, fn, data, pr_type, title);
+ } else if (expr_calc_value(e) == pr_type) {
+ if (*title) {
+ fn(data, NULL, *title);
+ *title = NULL;
+ }
+
fn(data, NULL, " - ");
expr_print(e, fn, data, E_NONE);
fn(data, NULL, "\n");
}
}
-void expr_gstr_print_revdep(struct expr *e, struct gstr *gs)
+void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
+ tristate pr_type, const char *title)
{
- expr_print_revdep(e, expr_print_gstr_helper, gs);
+ expr_print_revdep(e, expr_print_gstr_helper, gs, pr_type, &title);
}
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index c16e82e..8dbf2a4 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -310,7 +310,8 @@ struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
void expr_fprint(struct expr *e, FILE *out);
struct gstr; /* forward */
void expr_gstr_print(struct expr *e, struct gstr *gs);
-void expr_gstr_print_revdep(struct expr *e, struct gstr *gs);
+void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
+ tristate pr_type, const char *title);
static inline int expr_is_yes(struct expr *e)
{
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 7e70be3..3b9beca 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -827,14 +827,16 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
get_symbol_props_str(r, sym, P_SELECT, _(" Selects: "));
if (sym->rev_dep.expr) {
- str_append(r, _(" Selected by: \n"));
- expr_gstr_print_revdep(sym->rev_dep.expr, r);
+ expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Selected by [y]\n");
+ expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Selected by [m]\n");
+ expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Selected by [n]\n");
}
get_symbol_props_str(r, sym, P_IMPLY, _(" Implies: "));
if (sym->implied.expr) {
- str_append(r, _(" Implied by: \n"));
- expr_gstr_print_revdep(sym->implied.expr, r);
+ expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Implied by [y]\n");
+ expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Implied by [m]\n");
+ expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Implied by [n]\n");
}
str_append(r, "\n\n");
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] kconfig: Print reverse dependencies in groups
2018-02-21 5:44 [PATCH] kconfig: Print reverse dependencies in groups Masahiro Yamada
@ 2018-02-21 11:10 ` Petr Vorel
2018-02-21 11:17 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2018-02-21 11:10 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Sam Ravnborg, Ulf Magnusson, Eugeniu Rosca,
Luis R. Rodriguez, Randy Dunlap, linux-kernel, Nicolas Pitre
Hi Masahiro,
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Petr Vorel <pvorel@suse.cz>
Just please fix typo leading to segfault and add ':'
<snip>
> get_symbol_props_str(r, sym, P_SELECT, _(" Selects: "));
> if (sym->rev_dep.expr) {
> - str_append(r, _(" Selected by: \n"));
> - expr_gstr_print_revdep(sym->rev_dep.expr, r);
> + expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Selected by [y]\n");
> + expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Selected by [m]\n");
> + expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Selected by [n]\n");
Maybe add ':' to be consistent with the rest of titles?
+ expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Selected by [y]:\n");
+ expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Selected by [m]:\n");
+ expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Selected by [n]:\n");
> }
> get_symbol_props_str(r, sym, P_IMPLY, _(" Implies: "));
> if (sym->implied.expr) {
> - str_append(r, _(" Implied by: \n"));
> - expr_gstr_print_revdep(sym->implied.expr, r);
> + expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Implied by [y]\n");
> + expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Implied by [m]\n");
> + expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Implied by [n]\n");
And the same here.
+ the most important thing - copy paste error, which obviously leads to segfault on
"Implied by":
Try search for PTP_1588_CLOCK (in x86_64 defconfig). gdb in coredump shows
#0 0x000000000041043e in expr_print_revdep (e=0x0, fn=0x410297 <expr_print_gstr_helper>, data=0x7fff0f2a8640, pr_type=yes, title=0x7fff0f2a85a0) at scripts/kconfig/expr.c:1328
1328 if (e->type == E_OR) {
So the correct is:
expr_gstr_print_revdep(sym->implied.expr, r, yes, " Implied by [y]:\n");
expr_gstr_print_revdep(sym->implied.expr, r, mod, " Implied by [m]:\n");
expr_gstr_print_revdep(sym->implied.expr, r, no, " Implied by [n]:\n");
Kind regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] kconfig: Print reverse dependencies in groups
2018-02-21 11:10 ` Petr Vorel
@ 2018-02-21 11:17 ` Petr Vorel
2018-02-21 13:51 ` Ulf Magnusson
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2018-02-21 11:17 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Sam Ravnborg, Ulf Magnusson, Eugeniu Rosca,
Luis R. Rodriguez, Randy Dunlap, linux-kernel, Nicolas Pitre
Hi Masahiro,
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Acked-by: Petr Vorel <pvorel@suse.cz>
Well, I'm not really the one to ack anything here, so please:
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kconfig: Print reverse dependencies in groups
2018-02-21 11:17 ` Petr Vorel
@ 2018-02-21 13:51 ` Ulf Magnusson
0 siblings, 0 replies; 4+ messages in thread
From: Ulf Magnusson @ 2018-02-21 13:51 UTC (permalink / raw)
To: Petr Vorel
Cc: Masahiro Yamada, Linux Kbuild mailing list, Sam Ravnborg,
Eugeniu Rosca, Luis R. Rodriguez, Randy Dunlap,
Linux Kernel Mailing List, Nicolas Pitre
On Wed, Feb 21, 2018 at 12:17 PM, Petr Vorel <petr.vorel@gmail.com> wrote:
> Hi Masahiro,
>
>> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> Acked-by: Petr Vorel <pvorel@suse.cz>
> Well, I'm not really the one to ack anything here, so please:
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> Kind regards,
> Petr
Looks good to me too.
Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
Cheers,
Ulf
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-21 13:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-21 5:44 [PATCH] kconfig: Print reverse dependencies in groups Masahiro Yamada
2018-02-21 11:10 ` Petr Vorel
2018-02-21 11:17 ` Petr Vorel
2018-02-21 13:51 ` Ulf Magnusson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®