]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fpga: lattice-sysconfig-spi: simplify with spi_get_device_match_data()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Sun, 10 May 2026 08:51:58 +0000 (10:51 +0200)
committerXu Yilun <yilun.xu@linux.intel.com>
Mon, 11 May 2026 15:28:28 +0000 (23:28 +0800)
Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20260510090556.1582900-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
drivers/fpga/lattice-sysconfig-spi.c

index 3cabf5c1607038ab69ae763bc2eb9123a749eed6..5d195602b261520255b47011462ca9963c50907e 100644 (file)
@@ -91,7 +91,6 @@ static int sysconfig_spi_bitstream_burst_complete(struct sysconfig_priv *priv)
 
 static int sysconfig_spi_probe(struct spi_device *spi)
 {
-       const struct spi_device_id *dev_id;
        struct device *dev = &spi->dev;
        struct sysconfig_priv *priv;
        const u32 *spi_max_speed;
@@ -100,15 +99,7 @@ static int sysconfig_spi_probe(struct spi_device *spi)
        if (!priv)
                return -ENOMEM;
 
-       spi_max_speed = device_get_match_data(dev);
-       if (!spi_max_speed) {
-               dev_id = spi_get_device_id(spi);
-               if (!dev_id)
-                       return -ENODEV;
-
-               spi_max_speed = (const u32 *)dev_id->driver_data;
-       }
-
+       spi_max_speed = spi_get_device_match_data(spi);
        if (!spi_max_speed)
                return -EINVAL;