[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250729-spi-bus-extension-v1-2-b20c73f2161a@beagleboard.org>
Date: Tue, 29 Jul 2025 15:21:01 +0530
From: Ayush Singh <ayush@...gleboard.org>
To: Mark Brown <broonie@...nel.org>, herve.codina@...tlin.com,
luca.ceresoli@...tlin.com, conor+dt@...nel.org,
Jason Kridner <jkridner@...gleboard.org>,
Deepak Khatri <lorforlinux@...gleboard.org>, Dhruva Gole <d-gole@...com>,
Robert Nelson <robertcnelson@...gleboard.org>, Andrew Davis <afd@...com>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>
Cc: linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, Ayush Singh <ayush@...gleboard.org>
Subject: [PATCH 2/4] spi: Move children registration in a dedicated
function
of_register_spi_devices() perform the loop for registering child devices.
In order to prepare the support for spi bus extensions, extract this
registration loop and move it in a dedicated function.
Signed-off-by: Ayush Singh <ayush@...gleboard.org>
---
drivers/spi/spi.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 0030e0be0d9b2f9e2b0c4a1d806b42bdb4ecb5d2..ea271e37c72d3dc099c5147ec404050ee0bbf046 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2524,21 +2524,16 @@ of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc)
return ERR_PTR(rc);
}
-/**
- * of_register_spi_devices() - Register child devices onto the SPI bus
- * @ctlr: Pointer to spi_controller device
- *
- * Registers an spi_device for each child node of controller node which
- * represents a valid SPI target device.
- */
-static void of_register_spi_devices(struct spi_controller *ctlr)
+static void of_register_spi_children(struct spi_controller *ctlr,
+ struct device_node *node)
{
struct spi_device *spi;
struct device_node *nc;
- for_each_available_child_of_node(ctlr->dev.of_node, nc) {
+ for_each_available_child_of_node(node, nc) {
if (of_node_test_and_set_flag(nc, OF_POPULATED))
continue;
+
spi = of_register_spi_device(ctlr, nc);
if (IS_ERR(spi)) {
dev_warn(&ctlr->dev,
@@ -2547,6 +2542,18 @@ static void of_register_spi_devices(struct spi_controller *ctlr)
}
}
}
+
+/**
+ * of_register_spi_devices() - Register child devices onto the SPI bus
+ * @ctlr: Pointer to spi_controller device
+ *
+ * Registers an spi_device for each child node of controller node which
+ * represents a valid SPI target device.
+ */
+static void of_register_spi_devices(struct spi_controller *ctlr)
+{
+ of_register_spi_children(ctlr, ctlr->dev.of_node);
+}
#else
static void of_register_spi_devices(struct spi_controller *ctlr) { }
#endif
--
2.50.1
Powered by blists - more mailing lists