]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
spi: nxp-fspi: Propagate fwnode in ACPI case as well
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 26 Nov 2025 20:25:01 +0000 (21:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2025 21:27:33 +0000 (06:27 +0900)
[ Upstream commit 40ad64ac25bb736740f895d99a4aebbda9b80991 ]

Propagate fwnode of the ACPI device to the SPI controller Linux device.
Currently only OF case propagates fwnode to the controller.

While at it, replace several calls to dev_fwnode() with a single one
cached in a local variable, and unify checks for fwnode type by using
is_*_node() APIs.

Fixes: 55ab8487e01d ("spi: spi-nxp-fspi: Add ACPI support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20251126202501.2319679-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-nxp-fspi.c

index fcf10be66d391e1aa9c73ae809016db75e45bba9..f96638cae1d94c1b8d20f204ecd9c2dde7c1564b 100644 (file)
@@ -1270,7 +1270,7 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 {
        struct spi_controller *ctlr;
        struct device *dev = &pdev->dev;
-       struct device_node *np = dev->of_node;
+       struct fwnode_handle *fwnode = dev_fwnode(dev);
        struct resource *res;
        struct nxp_fspi *f;
        int ret, irq;
@@ -1292,7 +1292,7 @@ static int nxp_fspi_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, f);
 
        /* find the resources - configuration register address space */
-       if (is_acpi_node(dev_fwnode(f->dev)))
+       if (is_acpi_node(fwnode))
                f->iobase = devm_platform_ioremap_resource(pdev, 0);
        else
                f->iobase = devm_platform_ioremap_resource_byname(pdev, "fspi_base");
@@ -1300,7 +1300,7 @@ static int nxp_fspi_probe(struct platform_device *pdev)
                return PTR_ERR(f->iobase);
 
        /* find the resources - controller memory mapped space */
-       if (is_acpi_node(dev_fwnode(f->dev)))
+       if (is_acpi_node(fwnode))
                res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
        else
                res = platform_get_resource_byname(pdev,
@@ -1313,7 +1313,7 @@ static int nxp_fspi_probe(struct platform_device *pdev)
        f->memmap_phy_size = resource_size(res);
 
        /* find the clocks */
-       if (dev_of_node(&pdev->dev)) {
+       if (is_of_node(fwnode)) {
                f->clk_en = devm_clk_get(dev, "fspi_en");
                if (IS_ERR(f->clk_en))
                        return PTR_ERR(f->clk_en);
@@ -1366,7 +1366,7 @@ static int nxp_fspi_probe(struct platform_device *pdev)
        else
                ctlr->mem_caps = &nxp_fspi_mem_caps;
 
-       ctlr->dev.of_node = np;
+       device_set_node(&ctlr->dev, fwnode);
 
        ret = devm_add_action_or_reset(dev, nxp_fspi_cleanup, f);
        if (ret)