]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: Propagate default fwnode to the SPI controller device
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 12 Jan 2026 20:21:23 +0000 (21:21 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 19 Jan 2026 14:42:51 +0000 (14:42 +0000)
Most of the SPI controller drivers share the parent's fwnode
by explicit assignment. Propagate the default by SPI core,
so they may drop that in the code. Only corner cases may require
a special treatment and we simply (re)assign the controller's
fwnode explicitly (as it's done right now, no changes required
for that).

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260112203534.4186261-2-andriy.shevchenko@linux.intel.com
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-cs42l43.c
drivers/spi/spi.c

index 4b6b65f450a86c238ba0c66e03462c775d12b8cd..a4a650c8d7405e5a2ced10651cd017aaee2c4133 100644 (file)
@@ -371,6 +371,14 @@ static int cs42l43_spi_probe(struct platform_device *pdev)
 
        fwnode_property_read_u32(xu_fwnode, "01fa-sidecar-instances", &nsidecars);
 
+       /*
+        * Depending on the value of nsidecars we either create a software node
+        * or assign an fwnode. We don't want software node to be attached to
+        * the default one. That's why we need to clear the SPI controller fwnode
+        * first.
+        */
+       device_set_node(&priv->ctlr->dev, NULL);
+
        if (nsidecars) {
                struct software_node_ref_args args[] = {
                        SOFTWARE_NODE_REFERENCE(fwnode, 0, GPIO_ACTIVE_LOW),
index f077ea74e299e6540d47778422a2d0c3032c7e70..b773c297f8b147f8d0e61983122fd1a43bc26d30 100644 (file)
@@ -3072,6 +3072,9 @@ struct spi_controller *__spi_alloc_controller(struct device *dev,
        else
                ctlr->dev.class = &spi_controller_class;
        ctlr->dev.parent = dev;
+
+       device_set_node(&ctlr->dev, dev_fwnode(dev));
+
        pm_suspend_ignore_children(&ctlr->dev, true);
        spi_controller_set_devdata(ctlr, (void *)ctlr + ctlr_size);