mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
fpga: lattice-sysconfig-spi: simplify with spi_get_device_match_data()
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>
This commit is contained in:
parent
e7bfabd680
commit
24da2324f8
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user