Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3671845pxb; Mon, 21 Feb 2022 03:20:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkB5TM99JbooYod8P50SvhJHSRhqo3ZRB8mtwTRdEp+rrKP6LQHPrJxmEvfktzp6c6qmTT X-Received: by 2002:a17:906:2ec6:b0:69f:286a:66ab with SMTP id s6-20020a1709062ec600b0069f286a66abmr15741252eji.684.1645442407688; Mon, 21 Feb 2022 03:20:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645442407; cv=none; d=google.com; s=arc-20160816; b=oGa7aWUZkFxSrXzirHEveQxdY9tfyHDLLLWrSoCgj9uIqE9wdvb0ICJiu2OYGl/swc eQekZCi/FU16asql4/nbM2Bwm/CgaLZ9VGGXiEr0zD40zc3mNgIzWzCE4Wk2WFJPEVXb aHguCUrgWgoclxCoQfSn5nzpXKIca/B5UFLgjbzB2u/d53KL/W5iONCqA02+NKio2XJ9 JKiLtlzQEnqWqONSxRbqx/TO1/Vm9iCSDBwYj5I/QM9qnm7+R6VJjzCaSx8L9Hwa3qIO YaajQd1duaTJTxHrSL0Tmz4/K0Y7hYSw9GR0MuJk+eVYi4VJuiqm0Oxp/VY96GJ2nDis moOA== 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=70dlytb4aoCeBsrhKGwm2JKbhvzJwjdHj3JEAkjOHUQ=; b=aKc2LhDjwCUBc7hD5GPIvsgmkHi2Yiah4aB7HwmxG2gZ/MeWON3WDG8zVzvhf3Ed40 wp1AZTr+OGKXHszR6ifzDQa9zpOZeVlmvnXYEswNhH2V4rRZbr6pJqbMHpVoQa/kSzbn EGCVnXEfxhRzGO5Rcbamu1FEdbN2br4bx5Hp3rqZxq0LmvoDbyZ90Uok1xKgOJ5G8rm3 FDVrbciK2Z/47JB3/00z8IMrGhBGAeLCewrEAWom4wfEyTsCRnyfROOdqnf7oW6/uz7O Ojrvm5tlcq4ExlLcBYSKP+xbJPiSVbAbjjo0mh3QC2O2SwGDpX3zB7k3/qzUm3vLhaez Ayqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=lgBsEJRF; 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 g9si5968004ejt.866.2022.02.21.03.19.44; Mon, 21 Feb 2022 03:20:07 -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=lgBsEJRF; 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 S243147AbiBUI4c (ORCPT + 99 others); Mon, 21 Feb 2022 03:56:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345916AbiBUIyJ (ORCPT ); Mon, 21 Feb 2022 03:54:09 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4AE122BF8 for ; Mon, 21 Feb 2022 00:53:03 -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 64F4F223F0; Mon, 21 Feb 2022 09:53:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1645433581; 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=70dlytb4aoCeBsrhKGwm2JKbhvzJwjdHj3JEAkjOHUQ=; b=lgBsEJRFEJhmTVygEF6K6gg2MNw5wul7N4J2uvlc+VFKo3ET8cjm7CvrwKxA4X3n6JUVBa K7Opld8lSq+2yesGcJYAGZrE8p0hmpvlFqEjF+aq7lTPb9M1TIKV73qyJgnLF6lMdhwLvI X4rTFMQKmAyfOn1HWOORBT7ma4xKlw0= 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 v3 27/32] mtd: spi-nor: spansion: slightly rework control flow in late_init() Date: Mon, 21 Feb 2022 09:52:31 +0100 Message-Id: <20220221085236.1452024-28-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220221085236.1452024-1-michael@walle.cc> References: <20220221085236.1452024-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 dea021a8c9e4..22dedd199531 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