[PATCH v1 4/4] spi: Drop duplicate device_set_node() call

Andy Shevchenko
2026-01-08T20:30:42Z

The SPI core provides the default fwnode for the controller,
assigned by device_set_node(). No need to repeat it in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/spi/spi-airoha-snfi.c | 1 -
drivers/spi/spi-dln2.c | 2 --
drivers/spi/spi-dw-core.c | 2 --
drivers/spi/spi-ep93xx.c | 1 -
drivers/spi/spi-gpio.c | 1 -
drivers/spi/spi-ljca.c | 1 -
drivers/spi/spi-loongson-core.c | 1 -
drivers/spi/spi-mpc512x-psc.c | 2 --
drivers/spi/spi-mpc52xx-psc.c | 2 --
drivers/spi/spi-nxp-fspi.c | 2 --
drivers/spi/spi-pxa2xx.c | 2 --
drivers/spi/spi-realtek-rtl-snand.c | 1 -
drivers/spi/spi-rzv2h-rspi.c | 2 --
drivers/spi/spi-rzv2m-csi.c | 2 --
drivers/spi/spi-sc18is602.c | 2 --
drivers/spi/spi-sunplus-sp7021.c | 1 -
drivers/spi/spi-virtio.c | 2 --
17 files changed, 27 deletions(-)

diff --git a/drivers/spi/spi-airoha-snfi.c b/drivers/spi/spi-airoha-snfi.c
index 70327aebc26b..7b6c09f91fef 100644
--- a/drivers/spi/spi-airoha-snfi.c
+++ b/drivers/spi/spi-airoha-snfi.c
@@ -1124,7 +1124,6 @@ static int airoha_snand_probe(struct platform_device *pdev)
ctrl->bits_per_word_mask = SPI_BPW_MASK(8);
ctrl->mode_bits = SPI_RX_DUAL;
ctrl->setup = airoha_snand_setup;
- device_set_node(&ctrl->dev, dev_fwnode(dev));

err = airoha_snand_nfi_init(as_ctrl);
if (err)
diff --git a/drivers/spi/spi-dln2.c b/drivers/spi/spi-dln2.c
index 2013bc56ded8..fac737e18ac5 100644
--- a/drivers/spi/spi-dln2.c
+++ b/drivers/spi/spi-dln2.c
@@ -689,8 +689,6 @@ static int dln2_spi_probe(struct platform_device *pdev)
if (!host)
return -ENOMEM;

- device_set_node(&host->dev, dev_fwnode(dev));
-
platform_set_drvdata(pdev, host);

dln2 = spi_controller_get_devdata(host);
diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c
index 9ebf244294f8..0d59c141beb0 100644
--- a/drivers/spi/spi-dw-core.c
+++ b/drivers/spi/spi-dw-core.c
@@ -936,8 +936,6 @@ int dw_spi_add_controller(struct device *dev, struct dw_spi *dws)
if (!ctlr)
return -ENOMEM;

- device_set_node(&ctlr->dev, dev_fwnode(dev));
-
dws->ctlr = ctlr;
dws->dma_addr = (dma_addr_t)(dws->paddr + DW_SPI_DR);

diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
index e1d097091925..90d5f3ea6508 100644
--- a/drivers/spi/spi-ep93xx.c
+++ b/drivers/spi/spi-ep93xx.c
@@ -689,7 +689,6 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
/* make sure that the hardware is disabled */
writel(0, espi->mmio + SSPCR1);

- device_set_node(&host->dev, dev_fwnode(&pdev->dev));
error = devm_spi_register_controller(&pdev->dev, host);
if (error) {
dev_err(&pdev->dev, "failed to register SPI host\n");
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index c8dadb532c40..072127a38fad 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -351,7 +351,6 @@ static int spi_gpio_probe(struct platform_device *pdev)
return -ENOMEM;

if (fwnode) {
- device_set_node(&host->dev, fwnode);
host->use_gpio_descriptors = true;
} else {
status = spi_gpio_probe_pdata(pdev, host);
diff --git a/drivers/spi/spi-ljca.c b/drivers/spi/spi-ljca.c
index 3f412cf8f1cd..0c6e6248d8ba 100644
--- a/drivers/spi/spi-ljca.c
+++ b/drivers/spi/spi-ljca.c
@@ -238,7 +238,6 @@ static int ljca_spi_probe(struct auxiliary_device *auxdev,
controller->auto_runtime_pm = false;
controller->max_speed_hz = LJCA_SPI_BUS_MAX_HZ;

- device_set_node(&ljca_spi->controller->dev, dev_fwnode(&auxdev->dev));
auxiliary_set_drvdata(auxdev, controller);

ret = spi_register_controller(controller);
diff --git a/drivers/spi/spi-loongson-core.c b/drivers/spi/spi-loongson-core.c
index b46f072a0387..f50423c3db4c 100644
--- a/drivers/spi/spi-loongson-core.c
+++ b/drivers/spi/spi-loongson-core.c
@@ -210,7 +210,6 @@ int loongson_spi_init_controller(struct device *dev, void __iomem *regs)
controller->unprepare_message = loongson_spi_unprepare_message;
controller->set_cs = loongson_spi_set_cs;
controller->num_chipselect = 4;
- device_set_node(&controller->dev, dev_fwnode(dev));
dev_set_drvdata(dev, controller);

spi = spi_controller_get_devdata(controller);
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 3c1638ba5bee..a1aeb5403a74 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -480,8 +480,6 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *pdev)
host->use_gpio_descriptors = true;
host->cleanup = mpc512x_psc_spi_cleanup;

- device_set_node(&host->dev, dev_fwnode(dev));
-
tempp = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (IS_ERR(tempp))
return dev_err_probe(dev, PTR_ERR(tempp), "could not ioremap I/O port range\n");
diff --git a/drivers/spi/spi-mpc52xx-psc.c b/drivers/spi/spi-mpc52xx-psc.c
index 3bbeb8d5bfb8..73d2383461ca 100644
--- a/drivers/spi/spi-mpc52xx-psc.c
+++ b/drivers/spi/spi-mpc52xx-psc.c
@@ -319,8 +319,6 @@ static int mpc52xx_psc_spi_of_probe(struct platform_device *pdev)
host->transfer_one_message = mpc52xx_psc_spi_transfer_one_message;
host->cleanup = mpc52xx_psc_spi_cleanup;

- device_set_node(&host->dev, dev_fwnode(dev));
-
mps->psc = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (IS_ERR(mps->psc))
return dev_err_probe(dev, PTR_ERR(mps->psc), "could not ioremap I/O port range\n");
diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 50a7e4916a60..320b3d93df57 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -1383,8 +1383,6 @@ static int nxp_fspi_probe(struct platform_device *pdev)
else
ctlr->mem_caps = &nxp_fspi_mem_caps;

- device_set_node(&ctlr->dev, fwnode);
-
ret = devm_add_action_or_reset(dev, nxp_fspi_cleanup, f);
if (ret)
return ret;
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index ec7117a94d5f..78c399e95ef2 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1290,8 +1290,6 @@ int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp,
drv_data->controller_info = platform_info;
drv_data->ssp = ssp;

- device_set_node(&controller->dev, dev_fwnode(dev));
-
/* The spi->mode bits understood by this driver: */
controller->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;

diff --git a/drivers/spi/spi-realtek-rtl-snand.c b/drivers/spi/spi-realtek-rtl-snand.c
index 741cf2af3e91..7d5853d202c6 100644
--- a/drivers/spi/spi-realtek-rtl-snand.c
+++ b/drivers/spi/spi-realtek-rtl-snand.c
@@ -400,7 +400,6 @@ static int rtl_snand_probe(struct platform_device *pdev)
ctrl->mem_ops = &rtl_snand_mem_ops;
ctrl->bits_per_word_mask = SPI_BPW_MASK(8);
ctrl->mode_bits = SPI_RX_DUAL | SPI_RX_QUAD | SPI_TX_DUAL | SPI_TX_QUAD;
- device_set_node(&ctrl->dev, dev_fwnode(dev));

return devm_spi_register_controller(dev, ctrl);
}
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index aae916882915..23f0e92ae208 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -797,8 +797,6 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
controller->dma_rx = NULL;
}

- device_set_node(&controller->dev, dev_fwnode(dev));
-
ret = devm_spi_register_controller(dev, controller);
if (ret)
dev_err(dev, "register controller failed\n");
diff --git a/drivers/spi/spi-rzv2m-csi.c b/drivers/spi/spi-rzv2m-csi.c
index 7c0442883ac0..5d80939dddb5 100644
--- a/drivers/spi/spi-rzv2m-csi.c
+++ b/drivers/spi/spi-rzv2m-csi.c
@@ -634,8 +634,6 @@ static int rzv2m_csi_probe(struct platform_device *pdev)
controller->use_gpio_descriptors = true;
controller->target_abort = rzv2m_csi_target_abort;

- device_set_node(&controller->dev, dev_fwnode(dev));
-
ret = devm_request_irq(dev, irq, rzv2m_csi_irq_handler, 0,
dev_name(dev), csi);
if (ret)
diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c
index 1627aa66c965..78c558e7228e 100644
--- a/drivers/spi/spi-sc18is602.c
+++ b/drivers/spi/spi-sc18is602.c
@@ -251,8 +251,6 @@ static int sc18is602_probe(struct i2c_client *client)
if (!host)
return -ENOMEM;

- device_set_node(&host->dev, dev_fwnode(dev));
-
hw = spi_controller_get_devdata(host);

/* assert reset and then release */
diff --git a/drivers/spi/spi-sunplus-sp7021.c b/drivers/spi/spi-sunplus-sp7021.c
index 256ae07db6be..789b092fe8c0 100644
--- a/drivers/spi/spi-sunplus-sp7021.c
+++ b/drivers/spi/spi-sunplus-sp7021.c
@@ -419,7 +419,6 @@ static int sp7021_spi_controller_probe(struct platform_device *pdev)
ctlr = devm_spi_alloc_host(dev, sizeof(*pspim));
if (!ctlr)
return -ENOMEM;
- device_set_node(&ctlr->dev, dev_fwnode(dev));
ctlr->bus_num = pdev->id;
ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST;
ctlr->auto_runtime_pm = true;
diff --git a/drivers/spi/spi-virtio.c b/drivers/spi/spi-virtio.c
index 6aad9f1fd016..9e66c917fb75 100644
--- a/drivers/spi/spi-virtio.c
+++ b/drivers/spi/spi-virtio.c
@@ -344,8 +344,6 @@ static int virtio_spi_probe(struct virtio_device *vdev)
priv->vdev = vdev;
vdev->priv = priv;

- device_set_node(&ctrl->dev, dev_fwnode(&vdev->dev));
-
dev_set_drvdata(&vdev->dev, ctrl);

virtio_spi_read_config(vdev);
--
2.50.1