X-Received: by 2002:a17:906:32d8:b0:6ce:d850:f79 with SMTP id k24-20020a17090632d800b006ced8500f79mr19096ejk.414.1645626597531; Wed, 23 Feb 2022 06:29:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645626597; cv=none; d=google.com; s=arc-20160816; b=KLLoJZZPPNkj8OjAZw9y93ZOLB/KFITvfzMW/VerN+N0iEPhBksloStozO0vHzmd7v OeKuk6gNrEPhi26ZFrczQy3oc5pNV2lsxoyNdnsId/ahvxpEu6RKn8HkN4UEwzqxuvwJ s0RrIc0jeX2Q25pjZmoYvtKuLIGqU3fHzqugDSveNszWsQRlKVvAE3oa+dLRXbDG/w+Y d4PUQePgpWuidrsefsX08zQEKc4lBgiEQn1Lw6UP3aF0UsqGZhkgO1HmYBsAw1teAqfC VoOlODREphPktxGBqe62o4h8ynswkIiU6Nm5aeQsVkhVaaFe1JxSPPK7NNNU1cknyGLp BByQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uL11yQUerN/5PBAFbvZdCuFGauujjl+DUxFoPRdGU3I=; b=wGzu5vQKyDEFKUmaVzwyO8BHSyTP4SUzYTwUw1oV/l8lVDuEw/XOSUs4PDgJIbBWZ6 y6vGC1JeIiwA+XChuofB5uQwkUxR2AO99bKPrknJik9RlQIXYY4TppRarBuPbX1NU5+2 cUuLdfOt76UHBDsW1DR6CBk9YRuLg2pKP4MGgQAAyJpgRz+tOQgA6Pn8lKEhQgeS+iuh 0a8Bk0SNsefAi4JqaFqxmjPU2O03dF47Et0M8oda9VYkDPQQKnN2/jkEHbr9y9pQhoTx j2jFpL6A57ZSoCJfWV0bgnnQDg+tHzon1Bzr9uCTyH6aUFw/s/QRVU5ufPaXefF3Jjx6 YSzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=QtL3GOX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17si13828919edr.427.2022.02.23.06.29.33; Wed, 23 Feb 2022 06:29:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=QtL3GOX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241285AbiBWNqY (ORCPT + 99 others); Wed, 23 Feb 2022 08:46:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241040AbiBWNow (ORCPT ); Wed, 23 Feb 2022 08:44:52 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31DA1AD109 for ; Wed, 23 Feb 2022 05:44:17 -0800 (PST) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 13807223F7; Wed, 23 Feb 2022 14:44:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1645623856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uL11yQUerN/5PBAFbvZdCuFGauujjl+DUxFoPRdGU3I=; b=QtL3GOX2/84/4ZWhgcWRRiAnpysKy/vR/Pw2/S2angWY/B2sPG7t0fbYARHY5kL1ZEksMd GiEUjRTrTgW1BiCPR7oUb9KLs1tR1xw4PzCvGHG/RA3oPvdWxAjoYo1vPcJ2r7UUGgVo8U e0m0LrSVmUuKDL3/eylXnlxytq7IT7g= From: Michael Walle To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tudor Ambarus , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , yaliang.wang@windriver.com, Michael Walle Subject: [PATCH v5 27/32] mtd: spi-nor: spansion: slightly rework control flow in late_init() Date: Wed, 23 Feb 2022 14:43:53 +0100 Message-Id: <20220223134358.1914798-28-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220223134358.1914798-1-michael@walle.cc> References: <20220223134358.1914798-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Don't return early when the flash is smaller than or equal to 16MiB. We need to be able to register hooks for all sizes of flashes. This also has the benefit that it increases the readability of the code because the action, i.e. registering the fixups, is connected to the condition, i.e. flashes larger than 16MiB. Signed-off-by: Michael Walle Reviewed-by: Pratyush Yadav Tested-by: Pratyush Yadav # on mt35xu512aba, s28hs512t --- drivers/mtd/spi-nor/spansion.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c index 5affa8ae43a7..1a0e7214d9e5 100644 --- a/drivers/mtd/spi-nor/spansion.c +++ b/drivers/mtd/spi-nor/spansion.c @@ -296,13 +296,12 @@ static const struct flash_info spansion_nor_parts[] = { static void spansion_nor_late_init(struct spi_nor *nor) { - if (nor->params->size <= SZ_16M) - return; - - nor->flags |= SNOR_F_4B_OPCODES; - /* No small sector erase for 4-byte command set */ - nor->erase_opcode = SPINOR_OP_SE; - nor->mtd.erasesize = nor->info->sector_size; + if (nor->params->size > SZ_16M) { + nor->flags |= SNOR_F_4B_OPCODES; + /* No small sector erase for 4-byte command set */ + nor->erase_opcode = SPINOR_OP_SE; + nor->mtd.erasesize = nor->info->sector_size; + } } static const struct spi_nor_fixups spansion_nor_fixups = { -- 2.30.2