Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5321340rwp; Mon, 17 Jul 2023 01:48:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlFQf0zLTx5mIzhCPkpiMWrHRCdtwylhJgKTmPw0F9MZl0RhzQ35XhIfLnzTMge6vYhn8ChD X-Received: by 2002:a17:90a:4eca:b0:263:bc7b:a76d with SMTP id v10-20020a17090a4eca00b00263bc7ba76dmr10798819pjl.4.1689583713898; Mon, 17 Jul 2023 01:48:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689583713; cv=none; d=google.com; s=arc-20160816; b=wLY6xRcUvDOG2Jjk0IwtbXqvjTi/HQ3/J03itiMRf8queTJxU6FVUZlY28XdQCigGM 5K6AN23rcB89tvnwevXT3phIvGCwAfr3+sf40g9N3z2g+hmRCYLpcqXkgP4hciH12FR2 9SHz/ZIu5ivM6Vx643Leq3bIhO6VK2A0B3jkqHwMPvEvksMTbRro2VWsxVY48DLD4cxb LpgbntM6+T5h1hrxvx80eTRRtpZIGcH9NQjN6BJnxdX6tUYESYtepwJtNQVWSFBimbwM Hy3IF80al/T93E1jkTt5wicGPnHs8s+T1WnDNlkJLC3y0gTrHb0D/ogHRf5GdIX5dJz9 A4gA== 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=JpygR/0v0UTOXdyljMXVkuezv/HjT4xrIjOwJ6y50X0=; b=LfnbrTcmZFn9VsSu9P7EeggPcSxgUF8O1E0S9nssfPa7DRL1gzyccb7mh0J05QEAOW 3sCxfCY0xJiJJ5y8xP87SIyo3whXfSx3FW6jVA8M++1XnWpf964Lfq0eZVsU2LBJcl+0 Kwu0ZwW5Qx9gnr5zOHkbxrJWCnYUZJuXHSXFRR6LH8aBMyrQ+gHFr6PQRPZkbGxAqC2f kiQn9tU4PBj58eT8X+H//sBKQnR2L3U5NYzjEgyS1fxQ7oRSAXAwKJF594q2YQ8Xxgbu fS2wRgmXuAh8GaHUFjTBBDfJOZEV8K+gelVLmOVA5jIc+BxzbUcUHXrEN5wKRPALQpNC flBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=lVX2afz+; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n11-20020a17090ade8b00b00263b4a986cfsi5453219pjv.73.2023.07.17.01.48.22; Mon, 17 Jul 2023 01:48:33 -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=lVX2afz+; 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 S231191AbjGQHwN (ORCPT + 99 others); Mon, 17 Jul 2023 03:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231187AbjGQHwD (ORCPT ); Mon, 17 Jul 2023 03:52:03 -0400 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9D9E11F for ; Mon, 17 Jul 2023 00:51:53 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 9237360006; Mon, 17 Jul 2023 07:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1689580312; 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=lVX2afz+B4qHgh/0ieV127PWztHw9UJvh71z5wscYgDB5/SvgkKR28zKhnY88MpfJ31hF9 5HDWe6wAG8fQvwv2dGi9OLO7TIWBQnbp8HUQs2OcxsUSVHpMGPHU0q8RBU9T3dRLdSFVcm UB81cej5nuRO2KkhXGtjs0uxXsKvytd9mn5Mb/8TfnTymzPH3XEG6sDBEayofBwF2tSB34 NVNaGLUoqVyaCIGM6TbL0707/IkBJ/rr3jTPSzHZkbQNZwsTmbGwK6N9TYbR4sMv4EmZhW ggw34CztVbuFV8j2dz6a4oTcl1d0b4eoT/5bXGncQePmzTzfbgLp0e0ZODGPYQ== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman , Cc: Thomas Petazzoni , Robert Marko , Luka Perkov , Michael Walle , Randy Dunlap , Miquel Raynal Subject: [PATCH v6 2/3] nvmem: core: Create all cells before adding the nvmem device Date: Mon, 17 Jul 2023 09:51:46 +0200 Message-Id: <20230717075147.43326-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717075147.43326-1-miquel.raynal@bootlin.com> References: <20230717075147.43326-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 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; -- 2.34.1