From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4070C433F5 for ; Sun, 19 Sep 2021 21:50:29 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3411E60F9B for ; Sun, 19 Sep 2021 21:50:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3411E60F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2082A8324B; Sun, 19 Sep 2021 23:50:19 +0200 (CEST) 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="PWTlOj5K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4612582DA1; Sun, 19 Sep 2021 23:49:51 +0200 (CEST) Received: from mail-oo1-xc32.google.com (mail-oo1-xc32.google.com [IPv6:2607:f8b0:4864:20::c32]) (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 483DE8322E for ; Sun, 19 Sep 2021 23:49:45 +0200 (CEST) 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-oo1-xc32.google.com with SMTP id p22-20020a4a8156000000b002a8c9ea1858so1255100oog.11 for ; Sun, 19 Sep 2021 14:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tVY7LBTwYLmpQAp2cn0ryy/324h0a8qRUWymKGB1kDQ=; b=PWTlOj5KhUI8AMf72GL0YKRp6GEgmRFD8lHDbmTIMZTJBBCDdzfutPY9XzMuG//15o RkD/B364fZReXiVwJGXFJ8UywyAD59amL2t9200d5Imv3va6bwnQ/QPu9FEXpLapxCBf Sw9TpwXDC+M4z0fgBp2prPj6V1vv6/81Ac92o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tVY7LBTwYLmpQAp2cn0ryy/324h0a8qRUWymKGB1kDQ=; b=ilv4TjXYAHMNm3A+LWobT79XnteGiUeZ6jKWnKuaiS6pVosYrDF/xl3KhlxKRTOx7H Lbjh5i3u5q9ES3efrqFJbjgFV3LebhQgtuHai802iw4jilM00NqWzrqGOzQXCPN43ilr +xtrqVtsXcurReEMuETZ1s2PKEl0RfcSCzGWoa+3YmPoNUCEAhBWuAKzGioRuvbqAeXB y/NT2dt5eFRDYcDo6FscwAjbn5hcjjrZj31u9bYr2ot3biTGqnm3gVJ+egQp2N73pdqS CsJREihapd5euiKl9GYko/szFaKinrbxp+IzqvDuzymI8cWAN/gIABxBSMaBDGf6PW5L Ryxw== X-Gm-Message-State: AOAM532ZzySFNkgr8HdFOxPj+T0yGGWqLujSCgoncqnA0eL9/k0Qkq4G /qlFSICQrl6IlNSEBYPUmo56E3zCD44FQA== X-Google-Smtp-Source: ABdhPJzPxWRxauwd50q1dw5makI5uG5/xmHuOKS+jBFrF/FXeLppeCdVZ07T80e376TEnSFB7X8WJw== X-Received: by 2002:a4a:df01:: with SMTP id i1mr5282735oou.52.1632088183718; Sun, 19 Sep 2021 14:49:43 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id q25sm519897oof.33.2021.09.19.14.49.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Sep 2021 14:49:43 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Jagan Teki , Heinrich Schuchardt , Simon Glass , Pratyush Yadav , Mike Frysinger Subject: [PATCH v4 3/5] sf: Tidy up code to avoid #ifdef Date: Sun, 19 Sep 2021 15:49:34 -0600 Message-Id: <20210919214937.3829422-4-sjg@chromium.org> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog In-Reply-To: <20210919214937.3829422-1-sjg@chromium.org> References: <20210919214937.3829422-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Update this code to use IS_ENABLED() instead. Signed-off-by: Simon Glass Reviewed-by: Pratyush Yadav --- (no changes since v1) cmd/sf.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/cmd/sf.c b/cmd/sf.c index 15361a4bddf..72246d912fe 100644 --- a/cmd/sf.c +++ b/cmd/sf.c @@ -384,7 +384,6 @@ static int do_spi_protect(int argc, char *const argv[]) return ret == 0 ? 0 : 1; } -#ifdef CONFIG_CMD_SF_TEST enum { STAGE_ERASE, STAGE_CHECK, @@ -548,7 +547,6 @@ static int do_spi_flash_test(int argc, char *const argv[]) return 0; } -#endif /* CONFIG_CMD_SF_TEST */ static int do_spi_flash(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) @@ -582,10 +580,8 @@ static int do_spi_flash(struct cmd_tbl *cmdtp, int flag, int argc, ret = do_spi_flash_erase(argc, argv); else if (strcmp(cmd, "protect") == 0) ret = do_spi_protect(argc, argv); -#ifdef CONFIG_CMD_SF_TEST - else if (!strcmp(cmd, "test")) + else if (IS_ENABLED(CONFIG_CMD_SF_TEST) && !strcmp(cmd, "test")) ret = do_spi_flash_test(argc, argv); -#endif else ret = -1; @@ -597,16 +593,8 @@ usage: return CMD_RET_USAGE; } -#ifdef CONFIG_CMD_SF_TEST -#define SF_TEST_HELP "\nsf test offset len " \ - "- run a very basic destructive test" -#else -#define SF_TEST_HELP -#endif - -U_BOOT_CMD( - sf, 5, 1, do_spi_flash, - "SPI flash sub-system", +#ifdef CONFIG_SYS_LONGHELP +static const char long_help[] = "probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus\n" " and chip select\n" "sf read addr offset|partition len - read `len' bytes starting at\n" @@ -622,6 +610,14 @@ U_BOOT_CMD( " at `addr' to flash at `offset'\n" " or to start of mtd `partition'\n" "sf protect lock/unlock sector len - protect/unprotect 'len' bytes starting\n" - " at address 'sector'\n" - SF_TEST_HELP + " at address 'sector'" +#ifdef CONFIG_CMD_SF_TEST + "\nsf test offset len - run a very basic destructive test" +#endif +#endif /* CONFIG_SYS_LONGHELP */ + ; + +U_BOOT_CMD( + sf, 5, 1, do_spi_flash, + "SPI flash sub-system", long_help ); -- 2.33.0.464.g1972c5931b-goog