Skip to content

Commit af7647a

Browse files
miquelraynalmarckleinebudde
authored andcommitted
can: sja1000: Prepare the use of a threaded handler
In order to support a flavor of the sja1000 which sometimes freezes, it will be needed upon certain interrupts to perform a soft reset. The soft reset operation takes a bit of time, so better not do it within the hard interrupt handler but rather in a threaded handler. Let's prepare the possibility for sja1000_err() to request "interrupting" the current flow and request the threaded handler to be run while keeping the interrupt line low. There is no functional change. Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent cf8462a commit af7647a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/net/can/sja1000/sja1000.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
501501
struct sja1000_priv *priv = netdev_priv(dev);
502502
struct net_device_stats *stats = &dev->stats;
503503
uint8_t isrc, status;
504-
int n = 0;
504+
irqreturn_t ret = 0;
505+
int n = 0, err;
505506

506507
if (priv->pre_irq)
507508
priv->pre_irq(priv);
@@ -546,19 +547,23 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
546547
}
547548
if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) {
548549
/* error interrupt */
549-
if (sja1000_err(dev, isrc, status))
550+
err = sja1000_err(dev, isrc, status);
551+
if (err)
550552
break;
551553
}
552554
n++;
553555
}
554556
out:
557+
if (!ret)
558+
ret = (n) ? IRQ_HANDLED : IRQ_NONE;
559+
555560
if (priv->post_irq)
556561
priv->post_irq(priv);
557562

558563
if (n >= SJA1000_MAX_IRQ)
559564
netdev_dbg(dev, "%d messages handled in ISR", n);
560565

561-
return (n) ? IRQ_HANDLED : IRQ_NONE;
566+
return ret;
562567
}
563568
EXPORT_SYMBOL_GPL(sja1000_interrupt);
564569

0 commit comments

Comments
 (0)