Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1435735pxb; Fri, 18 Feb 2022 07:45:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSS/40Lnxp34P37DoP2HWG3ovvmiWlSaEQEybcGKhDNRKfCm/3MndxHTK1LNPj+bq6QE2j X-Received: by 2002:a05:6a00:1743:b0:4e0:c65e:d656 with SMTP id j3-20020a056a00174300b004e0c65ed656mr8579085pfc.5.1645199152263; Fri, 18 Feb 2022 07:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645199152; cv=none; d=google.com; s=arc-20160816; b=MXk2Vpd26HyZXo88Iyodaza11IRKiLESzCMRzso3dBbvU9rK4MCUJDIAAFvzKg4d0g TeEFdpwWkhAg+qoPrCRb0LFBIlG+XoBacP03x1lG800z162OS9n64VXokbT1HzfzpmWc sWWyEiL2ul8ho3Pl2PJUaNB4aiPux8vlMtrzLgfSM38KmJRSb7kyzXti+y3Mbr0X9iGp WVTlz1eSEAIw7pPKMtRucCFnBreQWG2+bOyBW/dR1Sr4nE6npaCVE63FgZuTBtY8iaxB Q/euxO2ykpmyZF7WiJXVKGXiLJhLxo/VcOXKrLGR/hY1YI0S+z5rT5DEx9TncePmpTYK ey1Q== 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=qL5CIZLAHLRpiDax8OyYMNlETCy029ApvOQa4Db/FjE=; b=uiE11fDDyXNkyvDfbLOTKNMBjoYaEtHrOdG2csLJsqjkZy8L6Sozt8Rc9zxE1XvMen 6z+OMd7WDo9wmjzRUZfEKO4EGK4LzdDS6lsHK5bGhsPcSGQTmj6V9RgWDntdK5Dy73md lFcmAZEcjer3RjE0vO7DE3o80lq8wJi4DA7H73i9CfHunz0bTy1Oyhrh++ohT8CEzIZK qJFLU7gH0BF4CUBjh5fUoo8iVLrQuWUy6y6TJdqFlhj9lU+Qmjjq9Jw/vRGv2ienb51k Mrj4K0NM06sA+5yIDAewkRZ7J4F8w8wi1Lw9JXDWufvZVyjr9uDPbkj8u78O2fX8YAk0 aTSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=l4OVKWXj; 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 e7si18717128plh.6.2022.02.18.07.45.35; Fri, 18 Feb 2022 07:45:52 -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=l4OVKWXj; 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 S234780AbiBRLif (ORCPT + 99 others); Fri, 18 Feb 2022 06:38:35 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234615AbiBRLgq (ORCPT ); Fri, 18 Feb 2022 06:36:46 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 676212B0B37 for ; Fri, 18 Feb 2022 03:36:26 -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 EE55622239; Fri, 18 Feb 2022 12:36:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1645184183; 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=qL5CIZLAHLRpiDax8OyYMNlETCy029ApvOQa4Db/FjE=; b=l4OVKWXjsEUdtM6dEv6mpQVeAEKoLjHvW4gL4me7Sbma6kr479g7i9wfxD1VFJW3VdYnLG nUDgiLYBcigIbJX1MJmjjFB9L/dkWsZSCtYDecV45lDJQP1ysH/hKoAfxbm3BEGgp7FGJP Vcx0VhgtyP988s2inFNnDuw7CTfCaeU= 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 v2 27/32] mtd: spi-nor: spansion: slightly rework control flow in late_init() Date: Fri, 18 Feb 2022 12:36:02 +0100 Message-Id: <20220218113607.1360020-28-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220218113607.1360020-1-michael@walle.cc> References: <20220218113607.1360020-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 --- 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 c57ee085e1ba..86665e55970d 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