diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2023-05-01 18:14:41 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2023-10-05 21:46:50 +0200 |
commit | 864c6f07d3c4a4ed40fca932d9aec17607c6cc96 (patch) | |
tree | 632c1215e001661aa009a01dc1af3c357512fd01 /drivers/net/can | |
parent | 3ecc09856afb83a02c4079db595f9dcc8122b3be (diff) | |
download | lwn-864c6f07d3c4a4ed40fca932d9aec17607c6cc96.tar.gz lwn-864c6f07d3c4a4ed40fca932d9aec17607c6cc96.zip |
can: at91_can: at91_poll_err(): fold in at91_poll_err_frame()
This is a preparation patch for the cleanup of at91_poll_err(). Fold
at91_poll_err_frame() into at91_poll_err() so that it can be easier
modified.
Link: https://lore.kernel.org/all/20231005-at91_can-rx_offload-v2-17-9987d53600e0@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/at91_can.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 94e9740c80de..2071011ee812 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c @@ -751,10 +751,18 @@ static int at91_poll_rx(struct net_device *dev, int quota) return received; } -static void at91_poll_err_frame(struct net_device *dev, - struct can_frame *cf, u32 reg_sr) +static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr) { struct at91_priv *priv = netdev_priv(dev); + struct sk_buff *skb; + struct can_frame *cf; + + if (quota == 0) + return 0; + + skb = alloc_can_err_skb(dev, &cf); + if (unlikely(!skb)) + return 0; /* CRC error */ if (reg_sr & AT91_IRQ_CERR) { @@ -797,21 +805,6 @@ static void at91_poll_err_frame(struct net_device *dev, cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; cf->data[2] |= CAN_ERR_PROT_BIT; } -} - -static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr) -{ - struct sk_buff *skb; - struct can_frame *cf; - - if (quota == 0) - return 0; - - skb = alloc_can_err_skb(dev, &cf); - if (unlikely(!skb)) - return 0; - - at91_poll_err_frame(dev, cf, reg_sr); netif_receive_skb(skb); |