Commit 9cdae370 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Marc Kleine-Budde

can: mcp251xfd: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/all/20240606142424.129709-3-krzysztof.kozlowski@linaro.orgSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent d4383d67
...@@ -1989,7 +1989,6 @@ MODULE_DEVICE_TABLE(spi, mcp251xfd_id_table); ...@@ -1989,7 +1989,6 @@ MODULE_DEVICE_TABLE(spi, mcp251xfd_id_table);
static int mcp251xfd_probe(struct spi_device *spi) static int mcp251xfd_probe(struct spi_device *spi)
{ {
const void *match;
struct net_device *ndev; struct net_device *ndev;
struct mcp251xfd_priv *priv; struct mcp251xfd_priv *priv;
struct gpio_desc *rx_int; struct gpio_desc *rx_int;
...@@ -2081,13 +2080,7 @@ static int mcp251xfd_probe(struct spi_device *spi) ...@@ -2081,13 +2080,7 @@ static int mcp251xfd_probe(struct spi_device *spi)
priv->pll_enable = pll_enable; priv->pll_enable = pll_enable;
priv->reg_vdd = reg_vdd; priv->reg_vdd = reg_vdd;
priv->reg_xceiver = reg_xceiver; priv->reg_xceiver = reg_xceiver;
priv->devtype_data = *(struct mcp251xfd_devtype_data *)spi_get_device_match_data(spi);
match = device_get_match_data(&spi->dev);
if (match)
priv->devtype_data = *(struct mcp251xfd_devtype_data *)match;
else
priv->devtype_data = *(struct mcp251xfd_devtype_data *)
spi_get_device_id(spi)->driver_data;
/* Errata Reference: /* Errata Reference:
* mcp2517fd: DS80000792C 5., mcp2518fd: DS80000789C 4. * mcp2517fd: DS80000792C 5., mcp2518fd: DS80000789C 4.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment