Skip to content

Commit f2d1a33

Browse files
andy-shevbroonie
authored andcommitted
spi: Propagate default fwnode to the SPI controller device
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>
1 parent 0f93ddd commit f2d1a33

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/spi/spi-cs42l43.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,14 @@ static int cs42l43_spi_probe(struct platform_device *pdev)
371371

372372
fwnode_property_read_u32(xu_fwnode, "01fa-sidecar-instances", &nsidecars);
373373

374+
/*
375+
* Depending on the value of nsidecars we either create a software node
376+
* or assign an fwnode. We don't want software node to be attached to
377+
* the default one. That's why we need to clear the SPI controller fwnode
378+
* first.
379+
*/
380+
device_set_node(&priv->ctlr->dev, NULL);
381+
374382
if (nsidecars) {
375383
struct software_node_ref_args args[] = {
376384
SOFTWARE_NODE_REFERENCE(fwnode, 0, GPIO_ACTIVE_LOW),

drivers/spi/spi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,6 +3072,9 @@ struct spi_controller *__spi_alloc_controller(struct device *dev,
30723072
else
30733073
ctlr->dev.class = &spi_controller_class;
30743074
ctlr->dev.parent = dev;
3075+
3076+
device_set_node(&ctlr->dev, dev_fwnode(dev));
3077+
30753078
pm_suspend_ignore_children(&ctlr->dev, true);
30763079
spi_controller_set_devdata(ctlr, (void *)ctlr + ctlr_size);
30773080

0 commit comments

Comments
 (0)