From patchwork Sun Feb 4 11:37:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 10199309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC77460247 for ; Sun, 4 Feb 2018 11:37:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA3D62811E for ; Sun, 4 Feb 2018 11:37:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B2B128446; Sun, 4 Feb 2018 11:37:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8B9E2811E for ; Sun, 4 Feb 2018 11:37:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751768AbeBDLho (ORCPT ); Sun, 4 Feb 2018 06:37:44 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:40327 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751468AbeBDLhn (ORCPT ); Sun, 4 Feb 2018 06:37:43 -0500 Received: by mail-wr0-f193.google.com with SMTP id i56so26765952wra.7 for ; Sun, 04 Feb 2018 03:37:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6ZmEMBueo5IG2JytHPvMLhtE5ZZJTzt0irZGS9Mf7Sg=; b=sVWrWnbv3DCOiyaz728gbCpfs7cGWdHN6+PGICincgB7XRn4wOZnVaZpQYq4qpYwHa iQ4PRMiKw7H9Arf0wjQtq7Kmz4wUNt8QCy28aBGYScK76ppBnE/dRZ27sGi5tmWxtHNa oEGWvtGVcFQnphYOlQUngWN9Ybtj6wILbEsqI/tGpf0kqzut1qzh5vXtW+fmDiupPgx5 +H4VfWRLJ88AHW2NPMmXXDhONdTNV98Ws6LZmsY/K3cUVKfZ/iK5uwAEJvVEkuSG0oXK EhQ/OyVXLdhfy+rCN7bPXoZUH15BuXlOx6lNY1UNm34GHurfGvXQR8K6v5lG7hQ7msCw yQNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6ZmEMBueo5IG2JytHPvMLhtE5ZZJTzt0irZGS9Mf7Sg=; b=IrbfM/V61P535VFJDpcwgBArZ78LMfjuAob4fh3JB0WCMHrZpkYU/8eETNnOLBSJaz YpEvaJP8LH4B+peJMpnltl/LlaU3In/kDQYneZ0vtiBIViPWdTD+Vje5ELVyH7YOwYX8 8SKCBE0Gxuxsednjg0qSTsO0XSkOeEBGZ46g9OvW3j2HagR5PkfCveyK6Mz8GGGlBuX8 M+p7AR6J6q7LYiKnbzUyIcC4FF7k1vZob3n/Ln86L9jwc0RnvB6SJfzbh8BUYWjYvAWT GePUvtMtHXTILUPykk8GnRicbaxYisLeue7XhF6Die8A9DBRwA6Oj5p4j36Ng1ksgY2x qThA== X-Gm-Message-State: AKwxytdgkP0A2hzQQ+C/JzSklLn7QVjyLK6KE1ByobNiXdSSo1FoQAt5 Gq3pY+nujRf6mO3iW1rR+44= X-Google-Smtp-Source: AH8x225jJdRtepae3y/5nJYB4AMtgqF9TOY2rJ/ZdIeZjAhj/bTyoEKgL8gyqjKMWVWetgHktZCw5A== X-Received: by 10.223.191.16 with SMTP id p16mr18164663wrh.231.1517744261701; Sun, 04 Feb 2018 03:37:41 -0800 (PST) Received: from erosca.home (ip1f12fd2f.dynamic.kabel-deutschland.de. [31.18.253.47]) by smtp.gmail.com with ESMTPSA id y204sm2529097wmg.44.2018.02.04.03.37.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Feb 2018 03:37:40 -0800 (PST) From: Eugeniu Rosca X-Google-Original-From: Eugeniu Rosca To: Masahiro Yamada , Ulf Magnusson , Nicolas Pitre , Randy Dunlap , Petr Vorel , Paul Bolle Cc: Eugeniu Rosca , linux-kbuild@vger.kernel.org, Eugeniu Rosca Subject: [PATCH] kconfig: Minimize 'Selected by' and 'Implied by' Date: Sun, 4 Feb 2018 12:37:12 +0100 Message-Id: <20180204113712.8983-1-rosca.eugeniu@gmail.com> X-Mailer: git-send-email 2.16.1 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eugeniu Rosca Commit 1ccb27143360 ("kconfig: make "Selected by:" and "Implied by:" readable") made an incredible improvement in how reverse dependencies are perceived by the user, by breaking down the single (often interminable) expression string into small readable chunks. Even so, what happens in practice when reading the reverse dependencies is that 80-90% of the OR sub-expressions simply don't matter, since they evaluate to [=n]. Assuming commit 617aebe6a97e ("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 30 of CONFIG options with the highest amount of OR sub-expressions that make up the final "{Selected,Implied} by" reverse dependency expression. | Config | Revdep all | Revdep ![=n] | |-------------------------------|------------|--------------| | 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 | | IRQ_DOMAIN | 75 | 19 | | SERIAL_CORE | 75 | 9 | | PHYLIB | 74 | 16 | | REGMAP_MMIO | 72 | 15 | | GENERIC_PHY | 67 | 20 | | DMA_ENGINE | 66 | 11 | | SERIAL_CORE_CONSOLE | 64 | 9 | | CRYPTO_BLKCIPHER | 64 | 13 | | PINMUX | 60 | 17 | | CRYPTO | 59 | 10 | | MII | 58 | 8 | | GPIOLIB_IRQCHIP | 58 | 9 | | MFD_SYSCON | 58 | 15 | | VIDEOBUF2_DMA_CONTIG | 46 | 4 | | REGMAP_IRQ | 45 | 6 | | REGMAP_SPI | 44 | 2 | | CLKSRC_MMIO | 42 | 5 | | SND_SOC_GENERIC_DMAENGINE_PCM | 41 | 3 | | CRYPTO_SHA1 | 37 | 2 | | REGMAP | 36 | 4 | The story behind the above is that we still 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. This patch attempts to bring at user's fingertips those reverse dependencies that actually participate in selection of given symbol filtering out the rest of them. Signed-off-by: Eugeniu Rosca --- scripts/kconfig/expr.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 2ba332b3fed7..147b2d8a8f3e 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -1234,14 +1234,24 @@ static void __expr_print(struct expr *e, void (*fn)(void *, struct symbol *, con fn(data, e->right.sym, e->right.sym->name); break; case E_OR: - if (revdep && e->left.expr->type != E_OR) - fn(data, NULL, "\n - "); - __expr_print(e->left.expr, fn, data, E_OR, revdep); - if (revdep) - fn(data, NULL, "\n - "); - else + if (revdep) { + struct expr *left = e->left.expr; + struct expr *right = e->right.expr; + + if (expr_calc_value(left) != no) { + if (left->type != E_OR) + fn(data, NULL, "\n - "); + __expr_print(left, fn, data, E_OR, revdep); + } + if (expr_calc_value(right) != no) { + fn(data, NULL, "\n - "); + __expr_print(right, fn, data, E_OR, revdep); + } + } else { + __expr_print(e->left.expr, fn, data, E_OR, revdep); fn(data, NULL, " || "); - __expr_print(e->right.expr, fn, data, E_OR, revdep); + __expr_print(e->right.expr, fn, data, E_OR, revdep); + } break; case E_AND: expr_print(e->left.expr, fn, data, E_AND);