Skip to content

Commit d9119b5

Browse files
Eugeniu Roscamasahir0y
authored andcommitted
kconfig: Print reverse dependencies in groups
Surprisingly or not, disabling a CONFIG option (which is assumed to be unneeded) may be not so trivial. Especially it is not trivial, when this CONFIG option is selected by a dozen of other configs. Before the moment commit 1ccb271 ("kconfig: make "Selected by:" and "Implied by:" readable") popped up in v4.16-rc1, it was an absolute pain to break down the "Selected by" reverse dependency expression in order to identify all those configs which select (IOW *do not allow disabling*) a certain feature (assumed to be not needed). This patch tries to make one step further by putting at users' fingertips the revdep top level OR sub-expressions grouped/clustered by the tristate value they evaluate to. This should allow the users to directly concentrate on and tackle the _active_ reverse dependencies. To give some numbers and quantify the complexity of certain reverse dependencies, assuming commit 617aebe ("Merge tag 'usercopy-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux"), ARCH=arm64 and vanilla arm64 defconfig, here is the top 10 CONFIG options with the highest amount of top level "||" sub-expressions/tokens that make up the final "Selected by" reverse dependency expression. | Config | All revdep | Active revdep | |-------------------|------------|---------------| | REGMAP_I2C | 212 | 9 | | CRC32 | 167 | 25 | | FW_LOADER | 128 | 5 | | MFD_CORE | 124 | 9 | | FB_CFB_IMAGEBLIT | 114 | 2 | | FB_CFB_COPYAREA | 111 | 2 | | FB_CFB_FILLRECT | 110 | 2 | | SND_PCM | 103 | 2 | | CRYPTO_HASH | 87 | 19 | | WATCHDOG_CORE | 86 | 6 | The story behind the above is that users need to visually review/evaluate 212 expressions which *potentially* select REGMAP_I2C in order to identify the expressions which *actually* select REGMAP_I2C, for a particular ARCH and for a particular defconfig used. To make this experience smoother, change the way reverse dependencies are displayed to the user from [1] to [2]. [1] Old representation of DMA_ENGINE_RAID: Selected by: - AMCC_PPC440SPE_ADMA [=n] && DMADEVICES [=y] && (440SPe || 440SP) - BCM_SBA_RAID [=m] && DMADEVICES [=y] && (ARM64 [=y] || ... - FSL_RAID [=n] && DMADEVICES [=y] && FSL_SOC && ... - INTEL_IOATDMA [=n] && DMADEVICES [=y] && PCI [=y] && X86_64 - MV_XOR [=n] && DMADEVICES [=y] && (PLAT_ORION || ARCH_MVEBU [=y] ... - MV_XOR_V2 [=y] && DMADEVICES [=y] && ARM64 [=y] - XGENE_DMA [=n] && DMADEVICES [=y] && (ARCH_XGENE [=y] || ... - DMATEST [=n] && DMADEVICES [=y] && DMA_ENGINE [=y] [2] New representation of DMA_ENGINE_RAID: Selected by [y]: - MV_XOR_V2 [=y] && DMADEVICES [=y] && ARM64 [=y] Selected by [m]: - BCM_SBA_RAID [=m] && DMADEVICES [=y] && (ARM64 [=y] || ... Selected by [n]: - AMCC_PPC440SPE_ADMA [=n] && DMADEVICES [=y] && (440SPe || ... - FSL_RAID [=n] && DMADEVICES [=y] && FSL_SOC && ... - INTEL_IOATDMA [=n] && DMADEVICES [=y] && PCI [=y] && X86_64 - MV_XOR [=n] && DMADEVICES [=y] && (PLAT_ORION || ARCH_MVEBU [=y] ... - XGENE_DMA [=n] && DMADEVICES [=y] && (ARCH_XGENE [=y] || ... - DMATEST [=n] && DMADEVICES [=y] && DMA_ENGINE [=y] Suggested-by: Masahiro Yamada <[email protected]> Signed-off-by: Eugeniu Rosca <[email protected]> Reviewed-by: Petr Vorel <[email protected]> Reviewed-by: Ulf Magnusson <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 9a47cee commit d9119b5

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

scripts/kconfig/expr.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,19 +1323,25 @@ void expr_gstr_print(struct expr *e, struct gstr *gs)
13231323
*/
13241324
static void expr_print_revdep(struct expr *e,
13251325
void (*fn)(void *, struct symbol *, const char *),
1326-
void *data)
1326+
void *data, tristate pr_type, const char **title)
13271327
{
13281328
if (e->type == E_OR) {
1329-
expr_print_revdep(e->left.expr, fn, data);
1330-
expr_print_revdep(e->right.expr, fn, data);
1331-
} else {
1329+
expr_print_revdep(e->left.expr, fn, data, pr_type, title);
1330+
expr_print_revdep(e->right.expr, fn, data, pr_type, title);
1331+
} else if (expr_calc_value(e) == pr_type) {
1332+
if (*title) {
1333+
fn(data, NULL, *title);
1334+
*title = NULL;
1335+
}
1336+
13321337
fn(data, NULL, " - ");
13331338
expr_print(e, fn, data, E_NONE);
13341339
fn(data, NULL, "\n");
13351340
}
13361341
}
13371342

1338-
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs)
1343+
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
1344+
tristate pr_type, const char *title)
13391345
{
1340-
expr_print_revdep(e, expr_print_gstr_helper, gs);
1346+
expr_print_revdep(e, expr_print_gstr_helper, gs, pr_type, &title);
13411347
}

scripts/kconfig/expr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
310310
void expr_fprint(struct expr *e, FILE *out);
311311
struct gstr; /* forward */
312312
void expr_gstr_print(struct expr *e, struct gstr *gs);
313-
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs);
313+
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
314+
tristate pr_type, const char *title);
314315

315316
static inline int expr_is_yes(struct expr *e)
316317
{

scripts/kconfig/menu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -828,16 +828,16 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
828828

829829
get_symbol_props_str(r, sym, P_SELECT, _(" Selects: "));
830830
if (sym->rev_dep.expr) {
831-
str_append(r, _(" Selected by: "));
832-
str_append(r, "\n");
833-
expr_gstr_print_revdep(sym->rev_dep.expr, r);
831+
expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Selected by [y]:\n");
832+
expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Selected by [m]:\n");
833+
expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Selected by [n]:\n");
834834
}
835835

836836
get_symbol_props_str(r, sym, P_IMPLY, _(" Implies: "));
837837
if (sym->implied.expr) {
838-
str_append(r, _(" Implied by: "));
839-
str_append(r, "\n");
840-
expr_gstr_print_revdep(sym->implied.expr, r);
838+
expr_gstr_print_revdep(sym->implied.expr, r, yes, " Implied by [y]:\n");
839+
expr_gstr_print_revdep(sym->implied.expr, r, mod, " Implied by [m]:\n");
840+
expr_gstr_print_revdep(sym->implied.expr, r, no, " Implied by [n]:\n");
841841
}
842842

843843
str_append(r, "\n\n");

0 commit comments

Comments
 (0)