From patchwork Tue Jan 31 15:26:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1734956 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=RVzw/kho; 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P5px259rnz23gV for ; Wed, 1 Feb 2023 02:33:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9207785B49; Tue, 31 Jan 2023 16:29:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="RVzw/kho"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 708AC85AFC; Tue, 31 Jan 2023 16:28:33 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 41B2B85AE9 for ; Tue, 31 Jan 2023 16:28:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2d.google.com with SMTP id e204so5765523iof.1 for ; Tue, 31 Jan 2023 07:28:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dp+/fPwbUqytjaX/kokDkuXARnJoYhWOTsd3zEpKlJM=; b=RVzw/khoRGRiD3d8LYYMWciNrGZyn+P9vSQl8uN4wHpeBwZ1aRqTqQlNEx+qup7PHl eix5CT1CEU6ru7XP4oQg67WlZ2e4CP40feQLyQ8J6wRBljxlqIBcykVL8Wn63+3HualZ Hz8ZNyphtmMs2ZDSpf3gWNHLH/YnwY3jfBjgw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dp+/fPwbUqytjaX/kokDkuXARnJoYhWOTsd3zEpKlJM=; b=SzqvKV9My+j8ymEk2lOuPngfI5i+be1Y0ONngbInLOln1jYqKGv8Z2JZn2lOvROiEw yMIkUh4qfdViaWQQ+1ZaXQRhWv6H2wh2S6bi1A/mLmESlpsbZ8huHxuKUHkzKX83zd9w 4VSeWtS/GJ+IJE8i5hZPYgmr9EjgvPvyd2UA4nnUdLM5kJL7evioa/w/lI2Jtlz6V5h3 5wyvm2WjYmP7qKC0KGK30/i6iwLbzuNfgjQ0bknnX01wfKm10NYda5XT5yNFy3B724cW YoLXn+a1y6DM3QYOGopAeseOQV+Qpe4mOmei5KChvDUi7QkZtZQhbBlhoPe/rQW2tHk8 Xbaw== X-Gm-Message-State: AO0yUKWWxqTG/gumW3emUe0Wrl2O7uU8q/lQHv3XJK+Wfg+jQdT2714H j+bQP1NtvtG5MBVt9RcgdEu8O0H0rSh2NFoF X-Google-Smtp-Source: AK7set+1sughi2o1Zn9gSuf9zapbUo3nx+ax+eAzrBx3bUqLP3CafRKXKg5yr7ruNkZRV1u1GPr4TA== X-Received: by 2002:a5e:d601:0:b0:715:f1fe:7bd0 with SMTP id w1-20020a5ed601000000b00715f1fe7bd0mr7829134iom.12.1675178883498; Tue, 31 Jan 2023 07:28:03 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id u4-20020a02cb84000000b0039db6cffcbasm5649328jap.71.2023.01.31.07.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 07:28:03 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Masahiro Yamada Subject: [PATCH 29/32] kconfig: drop config_opt_enabled() Date: Tue, 31 Jan 2023 08:26:59 -0700 Message-Id: <20230131152702.249197-30-sjg@chromium.org> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog In-Reply-To: <20230131152702.249197-1-sjg@chromium.org> References: <20230131152702.249197-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean This is include used in three places. It does not appear in Linux. Use IS_ENABLED() instead since it provides a similar feature, albeit needing brackets. Signed-off-by: Simon Glass --- drivers/fastboot/fb_command.c | 12 ++++++------ drivers/fastboot/fb_common.c | 4 ++-- include/linux/kconfig.h | 11 ----------- net/tftp.c | 3 ++- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c index 3a5e29861a2..23a18a26aa6 100644 --- a/drivers/fastboot/fb_command.c +++ b/drivers/fastboot/fb_command.c @@ -424,8 +424,8 @@ static void reboot_recovery(char *cmd_parameter, char *response) static void __maybe_unused oem_format(char *cmd_parameter, char *response) { char cmdbuf[32]; - const int mmc_dev = config_opt_enabled(CONFIG_FASTBOOT_FLASH_MMC, - CONFIG_FASTBOOT_FLASH_MMC_DEV, -1); + const int mmc_dev = IS_ENABLED(CONFIG_FASTBOOT_FLASH_MMC, + (CONFIG_FASTBOOT_FLASH_MMC_DEV), (-1)); if (!env_get("partitions")) { fastboot_fail("partitions not set", response); @@ -447,8 +447,8 @@ static void __maybe_unused oem_format(char *cmd_parameter, char *response) static void __maybe_unused oem_partconf(char *cmd_parameter, char *response) { char cmdbuf[32]; - const int mmc_dev = config_opt_enabled(CONFIG_FASTBOOT_FLASH_MMC, - CONFIG_FASTBOOT_FLASH_MMC_DEV, -1); + const int mmc_dev = IS_ENABLED(CONFIG_FASTBOOT_FLASH_MMC, + (CONFIG_FASTBOOT_FLASH_MMC_DEV), (-1)); if (!cmd_parameter) { fastboot_fail("Expected command parameter", response); @@ -473,8 +473,8 @@ static void __maybe_unused oem_partconf(char *cmd_parameter, char *response) static void __maybe_unused oem_bootbus(char *cmd_parameter, char *response) { char cmdbuf[32]; - const int mmc_dev = config_opt_enabled(CONFIG_FASTBOOT_FLASH_MMC, - CONFIG_FASTBOOT_FLASH_MMC_DEV, -1); + const int mmc_dev = IS_ENABLED(CONFIG_FASTBOOT_FLASH_MMC, + (CONFIG_FASTBOOT_FLASH_MMC_DEV), (-1)); if (!cmd_parameter) { fastboot_fail("Expected command parameter", response); diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c index 57b6182c46a..70fba02634f 100644 --- a/drivers/fastboot/fb_common.c +++ b/drivers/fastboot/fb_common.c @@ -96,8 +96,8 @@ int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) [FASTBOOT_REBOOT_REASON_FASTBOOTD] = "boot-fastboot", [FASTBOOT_REBOOT_REASON_RECOVERY] = "boot-recovery" }; - const int mmc_dev = config_opt_enabled(CONFIG_FASTBOOT_FLASH_MMC, - CONFIG_FASTBOOT_FLASH_MMC_DEV, -1); + const int mmc_dev = IS_ENABLED(CONFIG_FASTBOOT_FLASH_MMC, + (CONFIG_FASTBOOT_FLASH_MMC_DEV), (-1)); if (!IS_ENABLED(CONFIG_FASTBOOT_FLASH_MMC)) return -EINVAL; diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 50e5a3d7606..cebce7bb164 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -36,17 +36,6 @@ #define CONFIG_VAL(option) __config_val(option) -/* - * This uses a similar mechanism to config_enabled() above. If cfg is enabled, - * it resolves to the value of opt_cfg, otherwise it resolves to def_val - */ -#define config_opt_enabled(cfg, opt_cfg, def_val) _config_opt_enabled(cfg, opt_cfg, def_val) -#define _config_opt_enabled(cfg_val, opt_value, def_val) \ - __config_opt_enabled(__ARG_PLACEHOLDER_##cfg_val, opt_value, def_val) -#define __config_opt_enabled(arg1_or_junk, arg2, def_val) \ - ___config_opt_enabled(arg1_or_junk arg2, def_val) -#define ___config_opt_enabled(__ignored, val, ...) val - /* * Count number of arguments to a variadic macro. Currently only need * it for 1, 2 or 3 arguments. diff --git a/net/tftp.c b/net/tftp.c index c780c33f379..2e93a12f4c8 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -728,7 +728,8 @@ static void sanitize_tftp_block_size_option(enum proto_t protocol) switch (protocol) { case TFTPGET: - max_defrag = config_opt_enabled(CONFIG_IP_DEFRAG, CONFIG_NET_MAXDEFRAG, 0); + max_defrag = IS_ENABLED(CONFIG_IP_DEFRAG, + (CONFIG_NET_MAXDEFRAG), (0)); if (max_defrag) { /* Account for IP, UDP and TFTP headers. */ cap = max_defrag - (20 + 8 + 4);