Skip to content

Commit

Permalink
can: mcp251x: simplify with spi_get_device_match_data()
Browse files Browse the repository at this point in the history
Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://lore.kernel.org/all/[email protected]
[mkl: add intermediate cast to uintptr_t]
Signed-off-by: Marc Kleine-Budde <[email protected]>
  • Loading branch information
krzk authored and Joshua-Riek committed Oct 7, 2024
1 parent 2d964ab commit dac0115
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/net/can/spi/mcp251x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,6 @@ MODULE_DEVICE_TABLE(spi, mcp251x_id_table);

static int mcp251x_can_probe(struct spi_device *spi)
{
const void *match = device_get_match_data(&spi->dev);
struct net_device *net;
struct mcp251x_priv *priv;
struct clk *clk;
Expand Down Expand Up @@ -1338,10 +1337,7 @@ static int mcp251x_can_probe(struct spi_device *spi)
priv->can.clock.freq = freq / 2;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
CAN_CTRLMODE_LOOPBACK | CAN_CTRLMODE_LISTENONLY;
if (match)
priv->model = (enum mcp251x_model)(uintptr_t)match;
else
priv->model = spi_get_device_id(spi)->driver_data;
priv->model = (enum mcp251x_model)(uintptr_t)spi_get_device_match_data(spi);
priv->net = net;
priv->clk = clk;

Expand Down

0 comments on commit dac0115

Please sign in to comment.