From patchwork Fri Jun 12 11:02:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1308113 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=M974SI8B; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49jyVx0qKkz9sSt for ; Fri, 12 Jun 2020 21:02:49 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 896FF81C7C; Fri, 12 Jun 2020 13:02:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="M974SI8B"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6068881CB4; Fri, 12 Jun 2020 13:02:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0706.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::706]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0AB89819B8 for ; Fri, 12 Jun 2020 13:02:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UYksZdkdtx5cyppVqzcva9mk3s5m57a4M0WEZUS9E30oWKOMmPvWP0/lLkfWkin8uD+A5tHPtfwvaF1qDIr2YZJrYa0eh8IqXVG04VlfPiNuXkT0tHdk2dlXM/jEJcXB3ATZlwDFycKSR5jR+cn9xCNbTaqTrvPWriIdr/yT+L7AP9KpmeAN0giLt7HMzxmwp6fy1D9Uw4hOFhnHx9yBxGmM+U4D83NhyD62lyWuIlbK9DJZHC1sphI9JZ+X0kasHgmR+kFeGk0aypFl+in27EHwoKpRgmU2AS6bjLO8Eu3glOfi2UTvJDf9p/ZN2YY16wPyJeTji/xGKHkBBWHLZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TZcaxRYzJttUvCz5+84r4xonWDfKolyr4LIouqepwaQ=; b=LU8SOSS3JqgaotMMVa+tGpQBxEXyV1l1mOVBDa/cyB6rtkIjwe2iEEASSSdd9+Xo4gptqJWXYtaz8pvZCqFswt0Q7/nvFk6pTxYEU2Xk0Phhf8esiV+9Pi+frUmKgdgcgdrxta4hnSiVmVBpa05qHVo0s19gT/+lTE9lexe3v+sEHshdQS4XcW8g4ag035sekYLPaJpZJI0vgHz/CZg4ZXc8gKC/oT7/Aa7ZTpWVZtCJfHMub1YNeXjk2itBs4o3DSqEzJjXVI4J3Ox0z4JnkJyR/c6zwenShlWnRqTULboqjQo+Tybi1SBhNKqpG/qYOvHibZ1AY+3f2V2bHEJexw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TZcaxRYzJttUvCz5+84r4xonWDfKolyr4LIouqepwaQ=; b=M974SI8BNouNuSfSEbiAE3OGNZOexd9C279C8cLtsVT2xqFSfP+MnOt1a7IMmKIMwwO2ErafNYVPGs4+gM1SLpYTHwq/kew5NDxsQX0uUOm/krz2OkwvbLH3wwcALuekiBI3j9xnBAxd/byLDA/R1EzuCIStNRAQNPqF3tDK8VQ= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3156.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 11:02:26 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::91fd:aebc:e8cb:a663]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::91fd:aebc:e8cb:a663%7]) with mapi id 15.20.3088.021; Fri, 12 Jun 2020 11:02:26 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Robert Marko , Tom Rini , Lukasz Majewski , Simon Glass , Masahiro Yamada , Rasmus Villemoes Subject: [RFC PATCH 1/4] common/image.c: image_decomp: put IH_COMP_XXX cases inside ifndef USE_HOSTCC Date: Fri, 12 Jun 2020 13:02:13 +0200 Message-Id: <20200612110216.10355-2-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> References: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: AM6P193CA0048.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::25) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.112.31) by AM6P193CA0048.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 11:02:25 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.112.31] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dec4546b-1813-4b9e-0a39-08d80ec01713 X-MS-TrafficTypeDiagnostic: AM0PR10MB3156: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yCUrA89vT6dWZXuTf1vEZQw/sQRdc+Sfch02R0BvvZw8rN02vdfQQBVQVwXn1tIBlVSFJxAVW8Ov3B5iLwpBohBITaHQT2LstB9vp/LsWMIIJN3AJNV2Xp+AduMkWd+RA+JZlL/sDIkpbqdsix1Ia0ZM8JTz5uzepQcupshvmgH6y3sPBLNb29kT1PRrohFaet7KOBkork2Yrm9ky4pF6bjrFOAywqHoxf01vkn5+SehGrT3uQGBj5T4gWSifvRmCv3QybI4OtomE+c1mFeZXiSnEUg/jfPzLe7M16BtWbwIgwHmZrAmeMXzGtkeRnsYnifk5luOQXja6l2zYYy1uQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(376002)(346002)(136003)(39850400004)(366004)(396003)(6486002)(186003)(54906003)(107886003)(8976002)(8936002)(16526019)(36756003)(1076003)(44832011)(83380400001)(316002)(956004)(2616005)(6512007)(6916009)(6506007)(86362001)(6666004)(26005)(478600001)(8676002)(45080400002)(66946007)(66556008)(66476007)(2906002)(52116002)(4326008)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: hCKeQjoBr6YnLiDPSEQv0eeGToW5hJa2lOKTsfik9SJpx3o4teWHZkV5fl0tNVtTKKj7GjJHWWGAAh0gzW1yotzOKzZx2felqnhDo5ZkBk0WHbBOBFdeQtoxy7LNyDIvAWP6pyzJJSLfxfb3WPbcsOmYXYOzhfaliMxa1EAc0bvFHLTrIqT0Ks92KYHFb75/EKmdi3/H6a5dGm2hbuW0fD5rVs577tCiaRsZs5yV6T9bPAaajw4lpPvgNUA72W/s74zTr6EwX9Q6KBDMbgJAAHUOjh+bcxvOlC7ntbxtk8A31mLLPxNnq3gm2okUxtJ1nSZZqquXYSmpAJwWati7Qb+KDkh9TIcvra+G9nz8pkd+paXolG78+WxzHvd4GO+4P1hDFJUFOsfAaSECeot0rBg0cA4Y5ZtCnUvJqFpe8FzSvYR75NHIBljQtDbxqjUENr2X7O376X/ilmPTCer5askVevmQGMSk/IwrTfFfbrI= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: dec4546b-1813-4b9e-0a39-08d80ec01713 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 11:02:26.0056 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fSgI2Bg0yH2VMvwaOXU61aUsSnEqx6kRfqfeiwgBwoNlnIoDQFdoiY3TzDltJiGbvfROceX5PKeTp2ZGxK9hc7J2NKlSEy4rbYzNVfadLG0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3156 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean When building host tools, the CONFIG_GZIP etc. symbols are not defined anyway, so this does not (should not) change anything [1]. However, since the host tools also don't include linux/kconfig.h, one cannot use the CONFIG_IS_ENABLED() smartness in a preprocessor conditional, which in turn prevents one from adding, say, an #if CONFIG_IS_ENABLED(ZSTD) case. OTOH, with this, one can do that, and it also makes it possible to convert say, "#ifdef CONFIG_GZIP" to "#if CONFIG_IS_ENABLED(GZIP)" to make those other cases SPL-or-not-SPL-aware. [1] The gzip.h header is only included under !USE_HOSTCC, and removing the CONFIG_GZIP conditional hence both gives an "no declaration of gunzip" warning as well as breaks the link of the host tools, since the gunzip code is indeed not linked in. Signed-off-by: Rasmus Villemoes --- common/image.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/image.c b/common/image.c index e1ca1a7905..73f6845274 100644 --- a/common/image.c +++ b/common/image.c @@ -458,6 +458,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type, else ret = -ENOSPC; break; +#ifndef USE_HOSTCC #ifdef CONFIG_GZIP case IH_COMP_GZIP: { ret = gunzip(load_buf, unc_len, image_buf, &image_len); @@ -508,6 +509,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type, break; } #endif /* CONFIG_LZ4 */ +#endif /* !USE_HOSTCC */ default: printf("Unimplemented compression type %d\n", comp); return -ENOSYS; From patchwork Fri Jun 12 11:02:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1308114 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=A3zJPmuU; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49jyW84ltCz9sSt for ; Fri, 12 Jun 2020 21:03:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4E90481CD6; Fri, 12 Jun 2020 13:02:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="A3zJPmuU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D098181CC5; Fri, 12 Jun 2020 13:02:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0706.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::706]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0AD4D81C78 for ; Fri, 12 Jun 2020 13:02:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d0feZiKz1b7LC+a2yjTuYPTsn/god6v3huTttkF99LnontePLfyQ2LzYkeCBlXRArmOg3LcpuCq8JMjckjCD8aOBnZyD4PsrrqeO8/m3fdvV8lBc707MZtpKtihb3qIa6aqR8jbNGTOwtW09gP7pRUhTq38E54rpGiBJzMIs3mDqrHFVY078hL8ypzCHFwMxV4svi6rndoxZzjTEc2moouEGKnzTy8LoffiqXuBZl1GiPz6nfPcZcPAoMbCaNQiivl2QuYJnC5bPo4/b4hmIeycVI6wE49bENCFlC2QsmbDjvz3EAUhlPSfCZuA+lyD30uU3AR0k2rUDg0JjlglEUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ADs11DKTy1VBX1UMiK0DzEb9INwOM/47InSnbZM+1II=; b=ZnmHueodVWSi/FRlxe1w8zJGAENIDoJh4JgvdvhG9l0hUz7C4Fgd2D6NMWt0q1r+aJErQmYxoVW5Ra5TCQ6d+1Y5F1c707DqeAZUMnI8RQmIEfgMPCJbTIWA1IGBxWoa75t7uEmgbphidPw3Jf5fAJT78Y94VA5qTDTjg89iIi9vypo9XbXIw0U3AfwUc4xER85H51jrkBlsbXzcKHTPhRxFkpakaSG1nSKvbJt25Yvl5O+IcBD8rsB2IBeDw7fkMJO7afs52o4Ft5/feNV9BCdvIbm55i3df2L5+x9h6ASddHlCQP0n7rqjJuxrYvAtpWbDwLUbDqYSANwwEJb2sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ADs11DKTy1VBX1UMiK0DzEb9INwOM/47InSnbZM+1II=; b=A3zJPmuUYQ1LYS9r9GPPBNWtzJJ0Mj2VD0QaC9MCy+I5zEL89SX4NU3LGF+QKKg6VOdcjqeojeGBVOCB4aD2yCJ2APoqRTBNbAFo9s06QVso7Hlne6IV/SpYPRJ/TH5QwqEc32PMsdubBxfXWh3sFBjUWgsUOeJ1Rn9LMZ6TNTs= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3156.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 11:02:26 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::91fd:aebc:e8cb:a663]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::91fd:aebc:e8cb:a663%7]) with mapi id 15.20.3088.021; Fri, 12 Jun 2020 11:02:26 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Robert Marko , Tom Rini , Lukasz Majewski , Simon Glass , Masahiro Yamada , Rasmus Villemoes Subject: [RFC PATCH 2/4] linux/kconfig.h: simplify logic for choosing CONFIG_{SPL_, TPL_, }* Date: Fri, 12 Jun 2020 13:02:14 +0200 Message-Id: <20200612110216.10355-3-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> References: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: AM6P193CA0048.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::25) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.112.31) by AM6P193CA0048.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 11:02:26 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.112.31] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 575709d0-e4e0-4bf3-35e7-08d80ec0178b X-MS-TrafficTypeDiagnostic: AM0PR10MB3156: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 04dqzQ1zatoiYxsnPUzMgVYXEzBQv/HqDRl8JkFwxR8PEdPRCHUVgLJw9xQ+kYzOAU7fFJN0xzzlSM6i6sBajla18Q5h0/Pa4hPISKhJcMHoKHx4wjBnIl1VYiAnl6/WREDW4FA2GExqlC4DDGa2UQs3bNF4TBzSVEDrgURW+uCHS+95E7U4+mDzmHO9H/dpbkVyiuarHCK3/dVsTnyMctfXy4ZZaM/xYEaKHN6Y3DSefsyZtv6MUfHvx7DO+eWiAutKabv3Tv610LXz8hecmAeil1I9epmIGwBdvmqZNB++ii11IDJF+PcuXU5qlK0iUPi/70meajdrsYJ/jHIm6A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(376002)(346002)(136003)(39850400004)(366004)(396003)(6486002)(186003)(54906003)(107886003)(8976002)(8936002)(16526019)(36756003)(1076003)(44832011)(83380400001)(316002)(956004)(2616005)(6512007)(6916009)(6506007)(86362001)(6666004)(26005)(478600001)(8676002)(66946007)(66556008)(66476007)(2906002)(52116002)(4326008)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: N/wMO/uHV3Y3zFZ8TrMUYtL0fQE8RYiLRjrPlsCmyiKy82kdIAt8e3wzDpyG9MWpI9OdXE0unGevFs08Ni3tX+Wf+HpbCCMHAOszDfZ7VJpzju2RPVA4YoRojVvIlH0/sO1b+VulpkCeKKTmstzRda+Z/pKyiE/tOmoBSGzUDm4HfZr0F/Wuv1iiMr4efGuhJ99AD4CSeCFzXs2UM3JbVxRmjBNvHWEtscxB741tRHtFmR8KH9ZI24+Y+ci/vC7/M/SLCN/YCocGWeuLiTXbTKJQUTxmmUkYrsS61sQkFF6IAJZmBsHnwaT9+Dn/W75zVfdTiqgDSM8KsyVE8Y2+N7bJfBcJz+WpcF9mh8eiboz/y9qpn++zqf1MBV0Qj03qefG7Ey7tPEQXBH0EzTYmt7Cw6iXgG65Zyx7D0o4KwUMmRssaLVP1TwGbN4mk1ugH6eTQU4+zCJMjRyJbb6ncWP2BRIK5FqQXtJmbbHHxODI= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 575709d0-e4e0-4bf3-35e7-08d80ec0178b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 11:02:26.6512 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FiASSeTshDsx7fOJU9sFXNGjdypFh2NckmfF4GOy/Z/H1HpMSTvFGaOLPO2JWO3V7VgNCS9NmGPOXbWrPwwxUiHpfvaKobpilL9Am7UcRi8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3156 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Instead of using the arg1_or_junk trick to pick between two choices, with a bit of duplication between the branches (and most of the CONFIG_TPL_BUILD case being redundant, as _IS_TPL is known to be defined to 1 in that case), simply define a prefix that we inject between CONFIG_ and the given config symbol. This only requires one level of indirection (to get the _CONFIG_PREFIX macro expanded before the token concatenation takes place), and makes it easy to, say, introduce a CONFIG_HOSTTOOL_ prefix. [I would expect most HOSTTOOL_ symbols to just be def_bool y, but it would allow us to clean up some of the ifdef HOSTCC mess in the sources shared between U-Boot and host tools.] Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- include/linux/kconfig.h | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 3a2da738c4..56b8e5d787 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -47,30 +47,19 @@ * U-Boot add-on: Helper macros to reference to different macros * (CONFIG_ or CONFIG_SPL_ prefixed), depending on the build context. */ -#ifdef CONFIG_SPL_BUILD -#define _IS_SPL 1 -#endif - -#ifdef CONFIG_TPL_BUILD -#define _IS_TPL 1 -#endif #if defined(CONFIG_TPL_BUILD) -#define config_val(cfg) _config_val(_IS_TPL, cfg) -#define _config_val(x, cfg) __config_val(x, cfg) -#define __config_val(x, cfg) ___config_val(__ARG_PLACEHOLDER_##x, cfg) -#define ___config_val(arg1_or_junk, cfg) \ - ____config_val(arg1_or_junk CONFIG_TPL_##cfg, CONFIG_##cfg) -#define ____config_val(__ignored, val, ...) val +#define _CONFIG_PREFIX TPL_ +#elif defined(CONFIG_SPL_BUILD) +#define _CONFIG_PREFIX SPL_ #else -#define config_val(cfg) _config_val(_IS_SPL, cfg) -#define _config_val(x, cfg) __config_val(x, cfg) -#define __config_val(x, cfg) ___config_val(__ARG_PLACEHOLDER_##x, cfg) -#define ___config_val(arg1_or_junk, cfg) \ - ____config_val(arg1_or_junk CONFIG_SPL_##cfg, CONFIG_##cfg) -#define ____config_val(__ignored, val, ...) val +#define _CONFIG_PREFIX #endif +#define config_val(cfg) _config_val(_CONFIG_PREFIX, cfg) +#define _config_val(pfx, cfg) __config_val(pfx, cfg) +#define __config_val(pfx, cfg) CONFIG_ ## pfx ## cfg + /* * CONFIG_VAL(FOO) evaluates to the value of * CONFIG_FOO if CONFIG_SPL_BUILD is undefined, From patchwork Fri Jun 12 11:02:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1308115 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=U5IsXFvV; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49jyWP12jsz9sSt for ; Fri, 12 Jun 2020 21:03:13 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8355881CB4; Fri, 12 Jun 2020 13:02:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="U5IsXFvV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B7FD81CB4; Fri, 12 Jun 2020 13:02:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0706.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::706]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3657781C7C for ; Fri, 12 Jun 2020 13:02:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kLm2EPNXcu1FPsjEzalu5GTt5OmHcUI8aDrp5whxW8s+K1V8WrQoNegNSKt128A6A4FmU3ksovyzXPeu584JKEoVpaBJ2DOWKX1pNIh+oiYt93lK2Hml4c5yvBqxKwzehpTjsUagXhyKUidKv9sZ0c0N6SbTxa+72Wqn3lcYUVtRaqQ9824ImaFbUs+oPiXelQYi8viGohQ3gjhznfzU07T84zxjllBKC9uRuDqfMtmPzLAqjWKuPkk7BAvjaEvNCL8EoN0HlNn99DNlHlT9WAQBgkRpfFRqn5fHJwOXW/rq6l+OwZKufQfHzkMyGANjqbp05YFNyC/fm6LHNh7XZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xtYWpq24ovpTsZFeqRaDgly7KUx/gUh22VSLFSpxQlI=; b=EVNuxQ3Sm2jQnX4lKjsaVpzv8KOjA3hINGA9Oj+6yQO+P5FBHXmZfY3s7gKVocFrqgexWXEjxY+Msft4fQFdm5BtPEYMvOvaRulLC3UrN273/EsQQiFQbCm3rIsIoWz0vWvKG+bFlgDlna+4kT1bVNazMlgjG2CB5lbZSRl7HFszZsw/0JitU/z8q+4JpNlsRmpyZlKLg1ujrPpndZgqbXForxHlW+kG6qaxuAIG/DsqRYSEtsU0gSgChvBCiuO8ERKk6R7dG2AbU8BppwkfmTn961L+3pltbnbjOgDUGrMZ0NXMVfCwnnBeTiCOwW3usSe/KJB3Tldjt6xmYYuMoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xtYWpq24ovpTsZFeqRaDgly7KUx/gUh22VSLFSpxQlI=; b=U5IsXFvV/0Fsaj24EBjFRVl3yvJJWYJ7EZGXQsqinwJZn9yFqJvmZzP6dobaiBNqlnyximoJ9dKXS3P8zUPR92mo9w1GpNEAG6XOdoY8eF8t4l1uo+0alpJg/Qru1IcGHtROVQ92/4mbRuA9cy9v7Dj+CBK5+5SaDv5GCQtHIi0= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3156.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 11:02:27 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::91fd:aebc:e8cb:a663]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::91fd:aebc:e8cb:a663%7]) with mapi id 15.20.3088.021; Fri, 12 Jun 2020 11:02:27 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Robert Marko , Tom Rini , Lukasz Majewski , Simon Glass , Masahiro Yamada , Rasmus Villemoes Subject: [RFC PATCH 3/4] linux/kconfig.h: remove unused helper macros Date: Fri, 12 Jun 2020 13:02:15 +0200 Message-Id: <20200612110216.10355-4-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> References: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: AM6P193CA0048.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::25) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.112.31) by AM6P193CA0048.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 11:02:26 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.112.31] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 46658828-117b-47ec-622c-08d80ec017fa X-MS-TrafficTypeDiagnostic: AM0PR10MB3156: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: evnhx8UfRfGERZmY+xFTEeai/fwHV35boqZzbuq5gBs2hSmavntb6ROV6gtfQFdNAJR19AS7xlNq/vgnTFGB8lWe4++gXDllmePfatDqJnOID0uTxEcsHBAqDWcu/s7NwL/id6aj29H1obl5jI0+1QuhtC9pZSv8tRbiScvKxj8kGXbQFtVjmR8Wv/Hsa39MPiCKCY4cY2szMiqVN4svy5wClMNU+07a8Cduj/19dZtRFtgXs5DJEuihI8JRerfDHWWdCxHO2OVtkNHmVlDXvdoUns9APGdfgSrXltESCUyyt3K/ENBjcxKao81NoJ02eCu6NKtbNC5dn9/45oL3Aw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(376002)(346002)(136003)(39850400004)(366004)(396003)(6486002)(186003)(54906003)(107886003)(8976002)(8936002)(16526019)(36756003)(1076003)(44832011)(83380400001)(316002)(956004)(2616005)(6512007)(6916009)(6506007)(86362001)(6666004)(26005)(478600001)(8676002)(66946007)(66556008)(66476007)(2906002)(52116002)(4326008)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: j0hD4P7aoZtAxq1mi0gQCG2dvWuxG7XITepdZTFwjj5Es5qGX2keQNgloy5VwXbiqor9irzafjXP9bnovq4qUklRgFrGPXV3bRurP7oXfbfwCO1Pxv+HTgkJ0F3X5EDkMwKAU5ta8aNsjATizdcV435Fi5af9Zszkza7an7uoWy6ee9PxxiiGsO16kfyJGcYpbPXFZOeMMgqXxeQyEkiZvq0B7zxiU0nxqzFe45aNBONb2Op/buYEZyaC1UnP04EnRdK9hqXhIe8w56C1eDUQVXgH4AOz2MIyvz+3gGQ2/quHfJBnA/Z8cQ8WCnrXdEA6Xkr3npkr5Ubn7Fy3SoU/VsPLpcU4bLfDyZ7pn1u/kGrPfIA9kPyMz4CDw/bjla+G8vOYTkGeJCnoj6ssW+gpOfX5FxgGzPTubWnwYXLK9gpq+j0V9f0ebsuel8SVPhoTuYy5PrgD5QAjhtqeoT4a1hgjQaOGuH1xInJmCvUNOQ= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 46658828-117b-47ec-622c-08d80ec017fa X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 11:02:27.3898 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TwGDQBk98XumrQuxzRPXaSjmnO32qqXoyZhDDe7HMzupGe+bQa9FpEz/dxGSDdZBHEMniFpD8sCmqOf4ZfSBSzJFm+13VjqAWR1Fe4Qbrbg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3156 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean U-Boot does not have loadable modules, and nothing currently uses any of the (CONFIG_)?IS_(BUILTIN|MODULE) macros - only the (CONFIG_)?IS_ENABLED variants are ever used. While I understand the desire to keep this somewhat synchronized with linux, we've already departed by the introduction of the CONFIG_IS_ENABLED extra logic, and deleting these makes the next patch much simpler, since I won't have to duplicate a lot of logic for no real gain (as there are no users). Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- include/linux/kconfig.h | 40 +++++------------------------------- scripts/config_whitelist.txt | 2 -- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 56b8e5d787..caea505a0e 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -23,25 +23,12 @@ #define ___config_enabled(__ignored, val, ...) val /* - * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', + * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', * 0 otherwise. * */ #define IS_ENABLED(option) \ - (config_enabled(option) || config_enabled(option##_MODULE)) - -/* - * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 - * otherwise. For boolean options, this is equivalent to - * IS_ENABLED(CONFIG_FOO). - */ -#define IS_BUILTIN(option) config_enabled(option) - -/* - * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 - * otherwise. - */ -#define IS_MODULE(option) config_enabled(option##_MODULE) + (config_enabled(option)) /* * U-Boot add-on: Helper macros to reference to different macros @@ -70,29 +57,12 @@ /* * CONFIG_IS_ENABLED(FOO) evaluates to - * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y' or 'm', - * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y' or 'm', - * 1 if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y' or 'm', - * 0 otherwise. - */ -#define CONFIG_IS_ENABLED(option) \ - (config_enabled(CONFIG_VAL(option)) || \ - config_enabled(CONFIG_VAL(option##_MODULE))) - -/* - * CONFIG_IS_BUILTIN(FOO) evaluates to * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', + * 1 if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', * 0 otherwise. */ -#define CONFIG_IS_BUILTIN(option) config_enabled(CONFIG_VAL(option)) - -/* - * CONFIG_IS_MODULE(FOO) evaluates to - * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'm', - * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'm', - * 0 otherwise. - */ -#define CONFIG_IS_MODULE(option) config_enabled(CONFIG_VAL(option##_MODULE)) +#define CONFIG_IS_ENABLED(option) \ + (config_enabled(CONFIG_VAL(option))) #endif /* __LINUX_KCONFIG_H */ diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 2210f46e44..352db2b57a 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -875,9 +875,7 @@ CONFIG_IRAM_SIZE CONFIG_IRAM_STACK CONFIG_IRAM_TOP CONFIG_IRDA_BASE -CONFIG_IS_BUILTIN CONFIG_IS_ENABLED -CONFIG_IS_MODULE CONFIG_JFFS2_CMDLINE CONFIG_JFFS2_DEV CONFIG_JFFS2_LZO From patchwork Fri Jun 12 11:02:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1308116 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=R72EiEYT; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49jyWf4ZhDz9sSt for ; Fri, 12 Jun 2020 21:03:26 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B5A2681CE3; Fri, 12 Jun 2020 13:02:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="R72EiEYT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6490D81C7C; Fri, 12 Jun 2020 13:02:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0706.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::706]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3D58081C9E for ; Fri, 12 Jun 2020 13:02:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DGcxXBVeviue3CW5AQPzirfG4pmAdA7yrj/wadxPjOBTyMK5rUkimEbJQoCDxEpen0LUmsvkqdtdeYJK9JAv8QfISF4/cflCVy3+dXUbFPbgunYgfYZciO5cZ9i1JciR4gQ8RwifiBkhg0AHfpxtq42jY0eKhHDrZ6+ENgiMJf/mau2MIDy32kExiJ7AvusLkoZ222PUlBM+p4kZePde29AK53tZTzUoaAe2BTfUZy/cxvYnyLlTvP6chmPE8bt3tHH6hbGJYXnFxx4nKCCdP1ShKPlDyYYp9a4GU2Dc6vjl4tFzoD2QV/l7YLKRS2n+WGIX85aMJ0s+EHtLaIM8eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uvqRY0GrPLo5bBSj9HH9e3iBaicfuPAxCi66KXG1Dqw=; b=n3muG/ruINJIADYx/fvhmVZLbgXB61afO1yMLNDi2L69G76UbfpKKH7j76mq7uWzMizhoH9h0nIRFxHf+z0kWe+2AdSzekusT1kjFoWN48vymM6KSGq2/p4C89lKz20wUOr1IqgtAwcDFfJfK8LupRUnnUvytQMeWS6t7kJMlwgo909kynDRtQgOZlP1w0QiuNhYlAtvcR9+R8ZxW8RSAEBzABFLWcDxSepLDj7yxQbKIhOMS5Xu8xt6qeiAwKx1v5CuHNYdRN/e7qF28u8gx42jO9Ypd/ujr8F4+4HG8mWmLT7f9t2Bnj7xeNsWn/Uyo5Lsnm53FhyuReifMPK4DA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uvqRY0GrPLo5bBSj9HH9e3iBaicfuPAxCi66KXG1Dqw=; b=R72EiEYTxbbB91vWu69A9NLCNRh77evX8os6lwUXp6JTAKkQSi8+8uDvSpIGbFBGle8+s2t3xvcx22x+A4ktEdbXzOHwidubHOaMQKQDFNFEhsuTFUORoJexPHhU8Oty+iikGq1yf2MdB0SPRaUc5jgdQ9gKLOjPe3QOxFt0xCY= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3156.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Fri, 12 Jun 2020 11:02:28 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::91fd:aebc:e8cb:a663]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::91fd:aebc:e8cb:a663%7]) with mapi id 15.20.3088.021; Fri, 12 Jun 2020 11:02:28 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Robert Marko , Tom Rini , Lukasz Majewski , Simon Glass , Masahiro Yamada , Rasmus Villemoes Subject: [RFC PATCH 4/4] linux/kconfig.h: create two- and three-argument versions of CONFIG_IS_ENABLED Date: Fri, 12 Jun 2020 13:02:16 +0200 Message-Id: <20200612110216.10355-5-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> References: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: AM6P193CA0048.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::25) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.112.31) by AM6P193CA0048.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Fri, 12 Jun 2020 11:02:27 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.112.31] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f5bff6a6-974d-4917-efc7-08d80ec0184f X-MS-TrafficTypeDiagnostic: AM0PR10MB3156: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-Forefront-PRVS: 0432A04947 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: muNm/jdIj2jN4XA1nRQQkpvqGl6nelrCK0TjlIxMMkPzeDTsxabSryXvC2yQQdVW6CbelhwZOj22PIdi99XPCI91in6N6dLmAeepRJ3Jh7lkd5z0w/GAGXj2dzfVnDrvUyU+9GDhERAUo8QtFIxma3BTKJ6yFQD3EEtLQmFIuC8XpA5xBqdEOphcOZmwkPHXLB+YdtXffVDnGp9EyZWi3R0ccWJKOtn+vbMtPN9BqtQWRY8/wuOe0eGhODTgvGItTl97t3Nkq7b4VTWu80bPH/8cz450tDwsG1yvjeH6fURctt6LuYDzhjX+eQhKcJMBDP+6/nKHrRK0iS9WLlgAtFk17/JZJf1WRqi2GWJRmXixuhN2mfBmfox9e3hqJalW X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(376002)(346002)(136003)(39850400004)(366004)(396003)(6486002)(186003)(54906003)(107886003)(8976002)(8936002)(16526019)(36756003)(1076003)(44832011)(83380400001)(316002)(956004)(2616005)(6512007)(6916009)(6506007)(86362001)(6666004)(26005)(478600001)(8676002)(66946007)(66556008)(66476007)(2906002)(52116002)(4326008)(5660300002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: by5FEnx4+saQ7XB+U6WrStisXheXg7j/Z+PJARXAISNgWzeNp/1a7TKDt02pzfBo5uMvYEkQNgdPippKY7TI+sEbeLN0/z6oa4ZuOE2uSmBn7Sl5+rU9SVAd7KNU6uSaPKHrxTTA8bWyEJnWj7FEimHee66BLsO5nubY2n9bvTMTaQY3K8XmRKkGExUL5HvNM1DDJxxAg/javKhC90fToB4/anPNGIsaWvBud3a7ikcE5LetdImX/BgRPev2k3Q4oTXtYTzUEbhh2XlyvwUih1oFBZLAHMJWQMm0Y+DxOgQcUGfIwMS6CsZgHspl2JOeMw4HMyz/LAFwiwQRMDhDsaECeeNSgioUJo6tRCnUwg10zqxcZmIT+Xb/3gqna8WF5Iki9RrgZEtZc/28ZjFEhqYnTp9GC+rOLrU3HYfAfNJ0YPe46Ukr5oDfL5KHvXiMfE7tLw44gp2uzVrQKp0jqXAAWSQBvJNRZRF70SOUmok= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: f5bff6a6-974d-4917-efc7-08d80ec0184f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2020 11:02:27.9735 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /4HWZPyKuUsjK3+1FtQT69ZfWh/TyQt5ipoaM6Ql1p1kcrB3GpinmxaBSR5ipBPuyKWwozxizXfEh39ne8UdC3z2hvQ8WpxduLzOFCqBtlE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3156 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean This adds a bunch of preprocessor magic to extend the capabilities of CONFIG_IS_ENABLED. The existing semantics of CONFIG_IS_ENABLED(FOO) expanding to a 1 or 0 (depending on build context and the defined-ness or not of the appropriate CONFIG_FOO/CONFIG_SPL_FOO/CONFIG_TPL_FOO) are of course preserved. With this, one is also allowed a two-argument form CONFIG_IS_ENABLED(FOO, (something)) which expands to something precisely when CONFIG_IS_ENABLED(FOO) would expand to 1, and expands to nothing otherwise. It is, in other words, completely equivalent to the three lines #if CONFIG_IS_ENABLED(FOO) something #endif The second argument must be parenthesized in order to allow any tokens, including a trailing comma, to appear - one use case for this is precisely to make it a bit more ergonomic to build an array and only include certain items depending on .config. That should increase both readability and not least "git grep"ability. A third variant is also introduced, CONFIG_IS_ENABLED(FOO, (xxx), (yyy)) which corresponds to #if CONFIG_IS_ENABLED(FOO) xxx #else yyy #endif Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- include/linux/kconfig.h | 48 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index caea505a0e..d109ed3119 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -56,13 +56,55 @@ #define CONFIG_VAL(option) config_val(option) /* - * CONFIG_IS_ENABLED(FOO) evaluates to + * Count number of arguments to a variadic macro. Currently only need + * it for 1, 2 or 3 arguments. + */ +#define __arg6(a1, a2, a3, a4, a5, a6, ...) a6 +#define __count_args(...) __arg6(dummy, ##__VA_ARGS__, 4, 3, 2, 1, 0) + +#define __concat(a, b) ___concat(a, b) +#define ___concat(a, b) a ## b + +#define __unwrap(...) __VA_ARGS__ +#define __unwrap1(case1, case0) __unwrap case1 +#define __unwrap0(case1, case0) __unwrap case0 + +#define __CONFIG_IS_ENABLED_1(option) __CONFIG_IS_ENABLED_3(option, (1), (0)) +#define __CONFIG_IS_ENABLED_2(option, case1) __CONFIG_IS_ENABLED_3(option, case1, ()) +#define __CONFIG_IS_ENABLED_3(option, case1, case0) \ + __concat(__unwrap, config_enabled(CONFIG_VAL(option))) (case1, case0) + +/* + * CONFIG_IS_ENABLED(FOO) expands to * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', * 1 if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', * 0 otherwise. + * + * CONFIG_IS_ENABLED(FOO, (abc)) expands to + * abc if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', + * abc if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', + * abc if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', + * nothing otherwise. + * + * CONFIG_IS_ENABLED(FOO, (abc), (def)) expands to + * abc if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', + * abc if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', + * abc if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', + * def otherwise. + * + * The optional second and third arguments must be parenthesized; that + * allows one to include a trailing comma, e.g. for use in + * + * CONFIG_IS_ENABLED(ACME, ({.compatible = "acme,frobnozzle"},)) + * + * which adds an entry to the array being defined if CONFIG_ACME (or + * CONFIG_SPL_ACME/CONFIG_TPL_ACME, depending on build context) is + * set, and nothing otherwise. */ -#define CONFIG_IS_ENABLED(option) \ - (config_enabled(CONFIG_VAL(option))) + +#define CONFIG_IS_ENABLED(option, ...) \ + __concat(__CONFIG_IS_ENABLED_, __count_args(option, ##__VA_ARGS__)) (option, ##__VA_ARGS__) + #endif /* __LINUX_KCONFIG_H */