netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull-request: can 2012-02-20
@ 2012-02-20 10:58 Marc Kleine-Budde
  2012-02-20 10:58 ` [PATCH] can: sja1000: fix isr hang when hw is unplugged under load Marc Kleine-Budde
  2012-02-21  0:25 ` pull-request: can 2012-02-20 David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2012-02-20 10:58 UTC (permalink / raw)
  To: davem; +Cc: netdev

Hello David,

here's a single patch intendet for 3.3. Oliver Hartkopp fixed a problem in
the generic SJA1000 interrupt handler. If you unplug a PCMCIA or PCIe card,
 when the CAN bus is under high load, the interrupt handler my
loop forever, not noticing that the hardware has been removed. I added
stable to Cc, v3.2 was the first kernel with such a driver.

regards, Marc

---

The following changes since commit 64f0a836f600e9c31ffd511713ab5d328aa96ac8:

  b44: remove __exit from b44_pci_exit() (2012-02-19 18:57:51 -0500)

are available in the git repository at:
  git://gitorious.org/linux-can/linux-can.git master

Oliver Hartkopp (1):
      can: sja1000: fix isr hang when hw is unplugged under load

 drivers/net/can/sja1000/sja1000.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] can: sja1000: fix isr hang when hw is unplugged under load
  2012-02-20 10:58 pull-request: can 2012-02-20 Marc Kleine-Budde
@ 2012-02-20 10:58 ` Marc Kleine-Budde
  2012-02-21  0:25 ` pull-request: can 2012-02-20 David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2012-02-20 10:58 UTC (permalink / raw)
  To: davem; +Cc: netdev, Oliver Hartkopp, Marc Kleine-Budde

From: Oliver Hartkopp <socketcan@hartkopp.net>

In the case of hotplug enabled devices (PCMCIA/PCIeC) the removal of the
hardware can cause an infinite loop in the common sja1000 isr.

Use the already retrieved status register to indicate a possible hardware
removal and double check by reading the mode register in sja1000_is_absent.

Cc: stable@kernel.org [3.2+]
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/sja1000/sja1000.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index 04a3f1b..192b0d1 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -95,11 +95,16 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val)
 	spin_unlock_irqrestore(&priv->cmdreg_lock, flags);
 }
 
+static int sja1000_is_absent(struct sja1000_priv *priv)
+{
+	return (priv->read_reg(priv, REG_MOD) == 0xFF);
+}
+
 static int sja1000_probe_chip(struct net_device *dev)
 {
 	struct sja1000_priv *priv = netdev_priv(dev);
 
-	if (priv->reg_base && (priv->read_reg(priv, 0) == 0xFF)) {
+	if (priv->reg_base && sja1000_is_absent(priv)) {
 		printk(KERN_INFO "%s: probing @0x%lX failed\n",
 		       DRV_NAME, dev->base_addr);
 		return 0;
@@ -493,6 +498,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
 	while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) {
 		n++;
 		status = priv->read_reg(priv, REG_SR);
+		/* check for absent controller due to hw unplug */
+		if (status == 0xFF && sja1000_is_absent(priv))
+			return IRQ_NONE;
 
 		if (isrc & IRQ_WUI)
 			dev_warn(dev->dev.parent, "wakeup interrupt\n");
@@ -509,6 +517,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
 			while (status & SR_RBS) {
 				sja1000_rx(dev);
 				status = priv->read_reg(priv, REG_SR);
+				/* check for absent controller */
+				if (status == 0xFF && sja1000_is_absent(priv))
+					return IRQ_NONE;
 			}
 		}
 		if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: pull-request: can 2012-02-20
  2012-02-20 10:58 pull-request: can 2012-02-20 Marc Kleine-Budde
  2012-02-20 10:58 ` [PATCH] can: sja1000: fix isr hang when hw is unplugged under load Marc Kleine-Budde
@ 2012-02-21  0:25 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-02-21  0:25 UTC (permalink / raw)
  To: mkl; +Cc: netdev

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Mon, 20 Feb 2012 11:58:31 +0100

> here's a single patch intendet for 3.3. Oliver Hartkopp fixed a problem in
> the generic SJA1000 interrupt handler. If you unplug a PCMCIA or PCIe card,
>  when the CAN bus is under high load, the interrupt handler my
> loop forever, not noticing that the hardware has been removed. I added
> stable to Cc, v3.2 was the first kernel with such a driver.
> 

Pulled, thanks Marc.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-21  0:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-20 10:58 pull-request: can 2012-02-20 Marc Kleine-Budde
2012-02-20 10:58 ` [PATCH] can: sja1000: fix isr hang when hw is unplugged under load Marc Kleine-Budde
2012-02-21  0:25 ` pull-request: can 2012-02-20 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).