From patchwork Mon Aug 7 08:24:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 131765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1325765vqr; Mon, 7 Aug 2023 02:25:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERapCxfEEByAPkh03i0x0+km5Y6n1mD4f8RbNLoLxNlBzNMBXGZApq8gkstCZ1Tgw+OsHd X-Received: by 2002:a17:90a:6fe4:b0:262:f449:4497 with SMTP id e91-20020a17090a6fe400b00262f4494497mr8262494pjk.2.1691400326643; Mon, 07 Aug 2023 02:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691400326; cv=none; d=google.com; s=arc-20160816; b=h7P5GQgXQQdVB7A7iQMLyIEUNa8Z6gc8zBBXDslTZnHlTHHxoanUs+fa5k00rXRnXP IEKxB5txYARQJwzKMvDJxD4UV3ECz2m7BPdE25ybJ1RgFN+RaQUhlpFGXSOGeihvL1J6 ehCUKJM2ieIHb4gcJcH43M7n+WpqfDM5pHdhc5U+TwDFZ1e8qFxxqtABmmG6993vWxqh 1Fl+XtuqivtfX4aBOWxSnLohKbaAdakLvxYLeOdXs/IxBpSnjIKoF/vu6Cxze6sycCOF T9wa7liIJsR8EX7Maz2BW+E3W8BNZOous5p5AXKnmGyuEmQgukoh1VAhY+CHVp6J2gBJ k5XQ== 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=un3Uwaotmlox+IhpuLnflkjcgnz89/YG1Do8CcofnC8=; fh=OHS2tDwbcHt81zFnYeyYq8ynDfpjq+e2h9R20vebRfM=; b=fSeYwoj7Ga2U1yXxyWdbFh6QBpq6OijV1L2S329ZGLx3gnKAMa6hefIKvCuwGNFCYm AvOzZwlfnl7Krl1QFyugMivA1KaJ6tzBH8u36RMRB3BKTZV5qQ4h78RCK9Rk1uvpCsiX BUbcexlsgBburNufORfbKJMDN73TjQE6bAlZirhzaOEKj8sQBHCquKdl+XHrH/JwRI3J uLGwIahbuOxwUw8tKVv5V9IEk666RZBzOKibJIExc4ZQM51DK3BBMl3ErGYJOnzTHiCe HSK7X8S0P39SGUhatA6SzTEc+OTS1Q9s3Xe1Tl+NM1vTCEd9iLe8a9NpNaBjpmCIqrzJ 4DKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=YfPsMOia; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a17090a5d0300b0026958c3d255si1509810pji.126.2023.08.07.02.25.12; Mon, 07 Aug 2023 02:25:26 -0700 (PDT) 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=@bootlin.com header.s=gm1 header.b=YfPsMOia; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231195AbjHGIYc (ORCPT + 99 others); Mon, 7 Aug 2023 04:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231160AbjHGIY2 (ORCPT ); Mon, 7 Aug 2023 04:24:28 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0BD1170A for ; Mon, 7 Aug 2023 01:24:25 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 08C17E0005; Mon, 7 Aug 2023 08:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691396662; 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=un3Uwaotmlox+IhpuLnflkjcgnz89/YG1Do8CcofnC8=; b=YfPsMOia1mh7NlZNTd0z0v90XmIyRDVUTiXx0sWbBjHNy62wGwzTEZn9Czg/FN6L7wf6bb W+Xvc0gkWGhrCW2nBx7wj1JbhEDOpVAKSEpbhENhkq4g2Omw+cpUtJGoGiDMVNvKBkBqeq aEG57kS+oL7xgV/5h36ZWBzIvXSrdn0b1czkCG+H4t9gjVaqy3yLbV0/G6FURf688/PTcR zu1C+ApkGO6ypeueKTGNgNEXDGfEuOdTl21Bu2Qcjj+1LC20E6JyFYak7vcGswajX8tvKp KJ9vuqCAlM+djtj43n3jFeoOe4Lc9mz7cqB8XtDB2x8kBA2OCCBkLlMwe+9Reg== From: Miquel Raynal To: Srinivas Kandagatla Cc: Greg Kroah-Hartman , Thomas Petazzoni , Robert Marko , Luka Perkov , Michael Walle , , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Miquel Raynal Subject: [PATCH v8 1/8] nvmem: core: Create all cells before adding the nvmem device Date: Mon, 7 Aug 2023 10:24:12 +0200 Message-Id: <20230807082419.38780-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230807082419.38780-1-miquel.raynal@bootlin.com> References: <20230807082419.38780-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773561788828932949 X-GMAIL-MSGID: 1773561788828932949 Let's pack all the cells creation in one place, so they are all created before we add the nvmem device. Signed-off-by: Miquel Raynal --- drivers/nvmem/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 3f8c7718412b..48659106a1e2 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -998,12 +998,6 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) if (rval) goto err_remove_cells; - dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); - - rval = device_add(&nvmem->dev); - if (rval) - goto err_remove_cells; - rval = nvmem_add_cells_from_fixed_layout(nvmem); if (rval) goto err_remove_cells; @@ -1012,6 +1006,12 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) if (rval) goto err_remove_cells; + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); + + rval = device_add(&nvmem->dev); + if (rval) + goto err_remove_cells; + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem); return nvmem;