[PATCH] kconfig: Print reverse dependencies in groups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
---

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 ++-
 scripts/kconfig/menu.c | 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)
 {
diff --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

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux