Skip to contentSkip to conversation

fpga: lattice-sysconfig-spi: simplify with spi_get_device_match_data()

PATCH Applied Andy Shevchenko 2 participants 2 messages May 10 – May 11 FPGA manager framework

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fpga: lattice-sysconfig-spi: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.

---
v2: used correct parameter (LKP)

 drivers/fpga/lattice-sysconfig-spi.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/fpga/lattice-sysconfig-spi.c +1 -10
index 44691cfcf50a..a62ee5b7bfeb 100644
@@ -85,7 +85,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;
@@ -94,15 +93,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;
 
Signature · 1 line
2.50.1