]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
spi: omap2-mcspi: Use of_device_get_match_data()
authorRosen Penev <rosenp@gmail.com>
Tue, 19 May 2026 00:43:52 +0000 (17:43 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 25 May 2026 12:33:57 +0000 (13:33 +0100)
Use of_device_get_match_data() to fetch platform match data directly
instead of open-coding an of_match_device() lookup.

This also lets the driver drop the of_device.h include.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260519004352.627148-1-rosenp@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-omap2-mcspi.c

index d53f98aa0aacb8263f6d07115e4f5645de0f21ba..9cc078acc13cd9dd237b62da2af537e61b7fa32e 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/gcd.h>
 
 #include <linux/spi/spi.h>
@@ -1481,7 +1480,6 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
        int                     status = 0, i;
        u32                     regs_offset = 0;
        struct device_node      *node = pdev->dev.of_node;
-       const struct of_device_id *match;
 
        if (of_property_read_bool(node, "spi-slave"))
                ctlr = devm_spi_alloc_target(&pdev->dev, sizeof(*mcspi));
@@ -1509,10 +1507,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
        mcspi = spi_controller_get_devdata(ctlr);
        mcspi->ctlr = ctlr;
 
-       match = of_match_device(omap_mcspi_of_match, &pdev->dev);
-       if (match) {
+       pdata = of_device_get_match_data(&pdev->dev);
+       if (pdata) {
                u32 num_cs = 1; /* default number of chipselect */
-               pdata = match->data;
 
                of_property_read_u32(node, "ti,spi-num-cs", &num_cs);
                ctlr->num_chipselect = num_cs;