Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp454687lql; Mon, 11 Mar 2024 07:38:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEk/vM1ddqTaU+0tICyLQCDg+7xdsQgHSC51+JomKJdtEjF+NAsXEvT3od6HpYa6HZ78kAlJ8GOMbMFBvwkJitstKbrJ0FrSGGBG7kOg== X-Google-Smtp-Source: AGHT+IG3Wh1t1b8AYNwgSONgG6H+ve6CBrGV4fakxniDTxtMLKIUVPAtIcyPgKUGNrTJNRlGqFJ3 X-Received: by 2002:a05:6102:21a3:b0:473:1582:eea0 with SMTP id i3-20020a05610221a300b004731582eea0mr2936195vsb.20.1710167924323; Mon, 11 Mar 2024 07:38:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710167924; cv=pass; d=google.com; s=arc-20160816; b=y59Gf70FUiBoQ6srrYS/Bf1tplBP5GP01DFLFfaJEDObiblRga8SLTZ/TtBarCmo2W jUiaWDwmqL1HGtw0z/CaUcJQUqsKBM40Z1B9+nqhlKOdr3TNbLhkW08aDPAKTU2Ic5Hy ugg+aUZMR9pS9bkIePgtUjPreN5W9VJ4ytMnYAHS3k6UVR1AVDVJxGZSGMb3/shXUR+P n3idwgExZZs9wgpCHYjiClzZvAuzbve8E2DJf7rgRbYNhqBCEOZpd/tDsBxJGGFQNTb4 u9CjR+tST6yAZUoVAyww4LNZ56bvIAjtqG/sLLAixTjZ2YO+Yl2lsccYGcO2yTibHvMg tM6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to :references:to:from:cc:subject:message-id:date:dkim-signature; bh=uGHL9SnaaIZqB8o9TyhNtytVXc1GmZg1vLvexsNfWqs=; fh=v3gCkKAIdbKGviAoivfzAmkNc+uqtp2dMOl97Ly6RC4=; b=Xvlri/RcETnswZo8a08G4haNpsJMjxkzY7V2EWjDdPCkiHO1dC13QMBeWXvuaTCTLe wVeGz1DHs2R3zrlpR23vMikrfpt/zDOMmh3fINBkeow93XqQxxg5uBfeEuWLbrZ7Tkrf jklG0POsD9Qd9lnnGFkmRQZPLj8jECU1xe0+64Qvm/I9vguIe+k/B+DY1U7VN5ahosmL VNFReGHOmFatH+tGabCGKvgU24cPYuq7Fu96fE/Xm25QYBMbNir5+NtgFYz6WWpHhnOw KTU2qLkxxJ0Qbl2D/9trYB5UKe/2HEA9KzrcOfvyPBp3Yx5cp8/3K7NUl/UqZwGLJLbj a1YA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N4cR6e9Q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-98977-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i3-20020a67e2c3000000b00469acd3b12fsi459176vsm.255.2024.03.11.07.38.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 07:38:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98977-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N4cR6e9Q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-98977-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0F25E1C20E29 for ; Mon, 11 Mar 2024 14:38:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2DC841236; Mon, 11 Mar 2024 14:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N4cR6e9Q" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D6E040BEB for ; Mon, 11 Mar 2024 14:38:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167907; cv=none; b=HZNOrwLDc56E/VSuTS/RtDrniW2LmWYsDjmerqAEQ8tpP11nv//1NIYZ6atkJ/pJnH6DVKCfRdSJ1JvAkyE2YXaqKezwSmw2aC040x7jeBmEok/vb5ab0bIk/000Ii/KWpx9WLfUi02bEMP3KvX2d4fb++Z3OCbkGPVb3oUu11M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167907; c=relaxed/simple; bh=ikG1QQ6Ft/EuPBNRvKuFA2EUFI7GLaO5HRAitUly3CQ=; h=Content-Type:Date:Message-Id:Subject:Cc:From:To:References: In-Reply-To; b=C99aql9mOua0OMnZflllDQv5lMqyWVbh5r8wE9KRhYNLV0Kf/E3GK6L1HRWydZDt9nnZ0eWlQ96ueS5HAIE0ZHE1c2iCxcGKFmwIFUZMZAVdQm12UE4ErQ0zYBJ0nwodvHyRnepWN4o/Kkv1opbfbdLP5xr8PHiD5P9YMrBvkfE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N4cR6e9Q; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5702EC433C7; Mon, 11 Mar 2024 14:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710167905; bh=ikG1QQ6Ft/EuPBNRvKuFA2EUFI7GLaO5HRAitUly3CQ=; h=Date:Subject:Cc:From:To:References:In-Reply-To:From; b=N4cR6e9QRDrGNAQ621FMoQQTlT4j45Gs0eckfvY/M7lYe3RJPP9cqw4gTdvhWrIQs YgUCH/ufRSS7UTVj75iR4J3usZFQg/+ihEAuav2/1GsLYx/p15WkJlphSKT+VyvlaL 88Rw7kepSg7vzTJmrgPWImKZNbroOxc02gA3vxwviR3YU+nYvoS/R6CyS3pe95P9m7 ee0zJ4OEDuZ14nW+8bmQyAOYz4vC7+FDykLmGphbSUTaePAdSv9EPCyh1vUizWXpjj PaQhqCO7jRz4QSozttnWsSz9U/Twjt/+zx/nn67Xk/L6T56U+rCqZZqqUVUdxsFh6j f/7lKfBY4EZsg== Content-Type: multipart/signed; boundary=45ed013812313c157f704b5e662bd3e921269c7d51848b7e818b5055826c; micalg=pgp-sha256; protocol="application/pgp-signature" Date: Mon, 11 Mar 2024 15:38:17 +0100 Message-Id: Subject: Re: [PATCH 2/2] mtd: core: Don't fail mtd_device_parse_register() if OTP is unsupported Cc: "Mika Westerberg" From: "Michael Walle" To: "Aapo Vienamo" , "Miquel Raynal" , "Richard Weinberger" , "Vignesh Raghavendra" , , X-Mailer: aerc 0.16.0 References: <20240307130418.3131898-1-aapo.vienamo@linux.intel.com> <20240307130418.3131898-3-aapo.vienamo@linux.intel.com> In-Reply-To: <20240307130418.3131898-3-aapo.vienamo@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: --45ed013812313c157f704b5e662bd3e921269c7d51848b7e818b5055826c Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Thu Mar 7, 2024 at 2:04 PM CET, Aapo Vienamo wrote: > Handle the case where -EOPNOTSUPP is returned from OTP driver. > > This addresses an issue that occurs with the Intel SPI flash controller, > which has a limited supported opcode set. Whilst the OTP functionality > is not available due to this restriction, other parts of the MTD > functionality of the device are intact. This change allows the driver > to gracefully handle the restriction by allowing the supported > functionality to remain available instead of failing the probe > altogether. > > Signed-off-by: Aapo Vienamo > Reviewed-by: Mika Westerberg > > --- > drivers/mtd/mtdcore.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c > index c365c97e7232..1cfc8bb5187d 100644 > --- a/drivers/mtd/mtdcore.c > +++ b/drivers/mtd/mtdcore.c > @@ -1054,8 +1054,14 @@ int mtd_device_parse_register(struct mtd_info *mtd= , const char * const *types, > =20 > mtd_set_dev_defaults(mtd); > =20 > + /* > + * Don't abort MTD init if OTP functionality is unsupported. The > + * cleanup of the OTP init is contained within mtd_otp_nvmem_add(). > + * Omitting goto out here is safe since the cleanup code there > + * should be no-ops. > + */ Only if that's true for both the factory and user OTP area. Also, you'll print an error message for EOPNOTSUPP, although that is not really an error. Is that intended?=20 > ret =3D mtd_otp_nvmem_add(mtd); > - if (ret) > + if (ret && ret !=3D -EOPNOTSUPP) Maybe there is a better way to handle this, like controller capabilities instead of putting these EOPNOTSUPP checks everywhere? I'm not sure. -michael > goto out; > =20 > if (IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER)) { --45ed013812313c157f704b5e662bd3e921269c7d51848b7e818b5055826c Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIgEABYIADAWIQQCnWSOYTtih6UXaxvNyh2jtWxG+wUCZe8XWRIcbXdhbGxlQGtl cm5lbC5vcmcACgkQzcodo7VsRvumBgD+Ne3GfSC1vSlxnEWI5Pw4YrWak8YHEpYq E3KnfeyJR+wBALR/9/FAxfZci7xN2e0x1qQlGlpXIJeJiyCZctoKq7oO =B1CF -----END PGP SIGNATURE----- --45ed013812313c157f704b5e662bd3e921269c7d51848b7e818b5055826c--