[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230717075147.43326-3-miquel.raynal@bootlin.com>
Date: Mon, 17 Jul 2023 09:51:46 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
<linux-kernel@...r.kernel.org>
Cc: Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Robert Marko <robert.marko@...tura.hr>,
Luka Perkov <luka.perkov@...tura.hr>,
Michael Walle <michael@...le.cc>,
Randy Dunlap <rdunlap@...radead.org>,
Miquel Raynal <miquel.raynal@...tlin.com>
Subject: [PATCH v6 2/3] nvmem: core: Create all cells before adding the nvmem device
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 <miquel.raynal@...tlin.com>
---
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
Powered by blists - more mailing lists