summaryrefslogtreecommitdiff
path: root/drivers/net/can/at91_can.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2023-09-28 11:15:15 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2023-10-05 21:47:07 +0200
commite0c9db91d60ba44705a7f333cbed2be8b32b293c (patch)
treeb8fdca6252fd218d826613967b71026acfd416ee /drivers/net/can/at91_can.c
parentd3f4cf05402b06631f282e23dcba85daed732e38 (diff)
can: at91_can: at91_irq_err_frame(): move next to at91_irq_err()
This is a cleanup patch, no functional change intended. As at91_irq_err_frame() is called from the IRQ handler move it in front of the IRQ handler next to at91_irq_err(). Link: https://lore.kernel.org/all/20231005-at91_can-rx_offload-v2-20-9987d53600e0@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/at91_can.c')
-rw-r--r--drivers/net/can/at91_can.c122
1 files changed, 61 insertions, 61 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index a84da1995816..6b017fd695c0 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -750,67 +750,6 @@ static int at91_poll_rx(struct net_device *dev, int quota)
return received;
}
-static void at91_irq_err_frame(struct net_device *dev, const u32 reg_sr)
-{
- struct net_device_stats *stats = &dev->stats;
- struct at91_priv *priv = netdev_priv(dev);
- struct sk_buff *skb;
- struct can_frame *cf = NULL;
-
- priv->can.can_stats.bus_error++;
-
- skb = alloc_can_err_skb(dev, &cf);
- if (cf)
- cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
-
- if (reg_sr & AT91_IRQ_CERR) {
- netdev_dbg(dev, "CRC error\n");
-
- stats->rx_errors++;
- if (cf)
- cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;
- }
-
- if (reg_sr & AT91_IRQ_SERR) {
- netdev_dbg(dev, "Stuff error\n");
-
- stats->rx_errors++;
- if (cf)
- cf->data[2] |= CAN_ERR_PROT_STUFF;
- }
-
- if (reg_sr & AT91_IRQ_AERR) {
- netdev_dbg(dev, "NACK error\n");
-
- stats->tx_errors++;
- if (cf) {
- cf->can_id |= CAN_ERR_ACK;
- cf->data[2] |= CAN_ERR_PROT_TX;
- }
- }
-
- if (reg_sr & AT91_IRQ_FERR) {
- netdev_dbg(dev, "Format error\n");
-
- stats->rx_errors++;
- if (cf)
- cf->data[2] |= CAN_ERR_PROT_FORM;
- }
-
- if (reg_sr & AT91_IRQ_BERR) {
- netdev_dbg(dev, "Bit error\n");
-
- stats->tx_errors++;
- if (cf)
- cf->data[2] |= CAN_ERR_PROT_TX | CAN_ERR_PROT_BIT;
- }
-
- if (!cf)
- return;
-
- netif_receive_skb(skb);
-}
-
static int at91_poll(struct napi_struct *napi, int quota)
{
struct net_device *dev = napi->dev;
@@ -1061,6 +1000,67 @@ static void at91_irq_err(struct net_device *dev)
priv->can.state = new_state;
}
+static void at91_irq_err_frame(struct net_device *dev, const u32 reg_sr)
+{
+ struct net_device_stats *stats = &dev->stats;
+ struct at91_priv *priv = netdev_priv(dev);
+ struct sk_buff *skb;
+ struct can_frame *cf = NULL;
+
+ priv->can.can_stats.bus_error++;
+
+ skb = alloc_can_err_skb(dev, &cf);
+ if (cf)
+ cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
+
+ if (reg_sr & AT91_IRQ_CERR) {
+ netdev_dbg(dev, "CRC error\n");
+
+ stats->rx_errors++;
+ if (cf)
+ cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;
+ }
+
+ if (reg_sr & AT91_IRQ_SERR) {
+ netdev_dbg(dev, "Stuff error\n");
+
+ stats->rx_errors++;
+ if (cf)
+ cf->data[2] |= CAN_ERR_PROT_STUFF;
+ }
+
+ if (reg_sr & AT91_IRQ_AERR) {
+ netdev_dbg(dev, "NACK error\n");
+
+ stats->tx_errors++;
+ if (cf) {
+ cf->can_id |= CAN_ERR_ACK;
+ cf->data[2] |= CAN_ERR_PROT_TX;
+ }
+ }
+
+ if (reg_sr & AT91_IRQ_FERR) {
+ netdev_dbg(dev, "Format error\n");
+
+ stats->rx_errors++;
+ if (cf)
+ cf->data[2] |= CAN_ERR_PROT_FORM;
+ }
+
+ if (reg_sr & AT91_IRQ_BERR) {
+ netdev_dbg(dev, "Bit error\n");
+
+ stats->tx_errors++;
+ if (cf)
+ cf->data[2] |= CAN_ERR_PROT_TX | CAN_ERR_PROT_BIT;
+ }
+
+ if (!cf)
+ return;
+
+ netif_receive_skb(skb);
+}
+
/* interrupt handler
*/
static irqreturn_t at91_irq(int irq, void *dev_id)