From 7553f57af5a80c80dcb7957d1347a06dcc580805 Mon Sep 17 00:00:00 2001 From: norly Date: Thu, 17 Mar 2022 21:23:10 +0100 Subject: [PATCH] Get rid of dummy mailbox_read() for rx_offload Use can_rx_offload_add_manual() instead of can_rx_offload_add_fifo(), starting with Linux 5.10. --- module/elmcan.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module/elmcan.c b/module/elmcan.c index 9a58655..81d21f4 100644 --- a/module/elmcan.c +++ b/module/elmcan.c @@ -755,6 +755,7 @@ static void elm327_parse_rxbuf(struct elmcan *elm) } } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) /* Dummy needed to use can_rx_offload */ static struct sk_buff *elmcan_mailbox_read(struct can_rx_offload *offload, unsigned int n, u32 *timestamp, @@ -764,6 +765,7 @@ static struct sk_buff *elmcan_mailbox_read(struct can_rx_offload *offload, return ERR_PTR(-ENOBUFS); } +#endif static int elmcan_netdev_open(struct net_device *dev) { @@ -792,8 +794,12 @@ static int elmcan_netdev_open(struct net_device *dev) elm327_init(elm); spin_unlock_bh(&elm->lock); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) elm->offload.mailbox_read = elmcan_mailbox_read; err = can_rx_offload_add_fifo(dev, &elm->offload, ELM327_NAPI_WEIGHT); +#else + err = can_rx_offload_add_manual(dev, &elm->offload, ELM327_NAPI_WEIGHT); +#endif if (err) { close_candev(dev); return err; -- 2.30.2