Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4282626pxb; Mon, 21 Feb 2022 16:53:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyr3208qjcpDg8Y/RCjDHjx9pfj6UaLsSlUNasdds9h7ZtTwr+OqtQkzF0ACcHwuHUDKwf3 X-Received: by 2002:a17:903:1209:b0:14e:e31c:b8c4 with SMTP id l9-20020a170903120900b0014ee31cb8c4mr21658779plh.153.1645491185405; Mon, 21 Feb 2022 16:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645491185; cv=none; d=google.com; s=arc-20160816; b=Knd5iuNIFYNBtPz+QfkeOrzd59NGSowunPQ9XJ1rCUBO+epExD+arLXmLr62bAVT7N o9CwHNOEC0EIHrf9RSrLoimW1aS9lfNvEdvAYwmF5qgO+5TZXBOnfPy9OxJBR3ZUweVx /V2AQkIOhjeJ4kBL9R08zM7wx2CUz/iANix7cUBtWFFi7jfxpO3cz1FUUA0sY3ZTxWSN WZqjoAbnZHHkr2LkZ1E78vCQJzKqRLBSFWR2oHcEpaEJM3F6iW2qIIkjWy+iNAf6Oo7Z gyVQPS+7fTfeh6cwxUsteoterYuem3FTvrllPcU9yEvNyrkXUj7IIzJtrXQo0+XPBvd0 RNQw== 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=3zsnrIhLoM0lShucyLsd9YgNoCMcFbg27IxCcc/idRc=; b=0nUVqHiixY/0AdjFUsJ8yOklsN/dapYiYhjRXaTBbREz6NUiMHikLVH84Ea3xsiMDb jiFZeH+A+e2GR3GgrduPsAX9tuH9ZuvwY4A+w6U8FRpRDG265+m8z4ifGEUcVCw8tAAI grwsXdOGp8P5CLBCumm+K0mlzPj9mnwG/SFooWbRUVEkorYAHSq7YBoiQH32Dx4zR2ep t9KuSyCSymIV1s1lnLtil8ZOZUuf8nLcDawkvnj/SlPYRB3UqXy2wFL1Payxe8xZZRkf IhRzcRmc5L4N6a9QQOgB9ZRdPoCrBffNVS6ho8D9l+5YmYjigy5JShfL3OVeJRY7tsHJ IJHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=Hefqen4x; 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 p6si29047231plr.244.2022.02.21.16.52.49; Mon, 21 Feb 2022 16:53:05 -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=Hefqen4x; 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 S1357555AbiBUMMQ (ORCPT + 99 others); Mon, 21 Feb 2022 07:12:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357335AbiBUMIz (ORCPT ); Mon, 21 Feb 2022 07:08:55 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 400A9201AB for ; Mon, 21 Feb 2022 04:08:32 -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 5A9A8223F6; Mon, 21 Feb 2022 13:08:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1645445310; 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=3zsnrIhLoM0lShucyLsd9YgNoCMcFbg27IxCcc/idRc=; b=Hefqen4x6zIfPjTbqB3a1XsbApVYtZBxP9QmWGdmeOVg/jFjcS0StKeTVjclXhmJt6vyuT CV1/vvymuRNEVWQbiOvNARdlyGzIr8wJkKgi5xFdt9D5P8cUVTqDk9XgKFf/nO/Y7t92Fw LvVMvMUCP6ie21+sWcRditPsTl9o+Y4= 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 v4 27/32] mtd: spi-nor: spansion: slightly rework control flow in late_init() Date: Mon, 21 Feb 2022 13:08:04 +0100 Message-Id: <20220221120809.1531502-28-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220221120809.1531502-1-michael@walle.cc> References: <20220221120809.1531502-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 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