linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Stephane Grosjean <s.grosjean@peak-system.com>,
	linux-can Mailing List <linux-can@vger.kernel.org>
Subject: Re: [PATCH v3] can/sja1000: add support for PEAK-System PCMCIA card
Date: Mon, 13 Feb 2012 12:08:42 +0100	[thread overview]
Message-ID: <4F38EF3A.7040907@grandegger.com> (raw)
In-Reply-To: <4F38EEAD.3060607@pengutronix.de>

On 02/13/2012 12:06 PM, Marc Kleine-Budde wrote:
> On 02/13/2012 12:02 PM, Wolfgang Grandegger wrote:
>> On 02/13/2012 11:41 AM, Oliver Hartkopp wrote:
>>> On 13.02.2012 11:14, Wolfgang Grandegger wrote:
>>>
>>>
>>>>>> diff --git a/drivers/net/can/sja1000/sja1000.c
>>>>>> b/drivers/net/can/sja1000/sja1000.c
>>>>>> index ebbcfca..f7526a7 100644
>>>>>> --- a/drivers/net/can/sja1000/sja1000.c
>>>>>> +++ b/drivers/net/can/sja1000/sja1000.c
>>>>>> @@ -493,6 +493,10 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
>>>>>>                  n++;
>>>>>>                  status = priv->read_reg(priv, REG_SR);
>>>>>>
>>>>>> +               /* check for absent controller due to hw unplug */
>>>>>> +               if (status == 0xFF)
>>>>>> +                       break;
>>>>>> +
>>>>>>                  if (isrc&  IRQ_WUI)
>>>>>>                          netdev_warn(dev, "wakeup interrupt\n");
>>>>>>
>>>>>> @@ -504,8 +508,8 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
>>>>>>                          netif_wake_queue(dev);
>>>>>>                  }
>>>>>>                  if (isrc&  IRQ_RI) {
>>>>>> -                       /* receive interrupt */
>>>>>> -                       while (status&  SR_RBS) {
>>>>>> +                       /* receive interrupt / check for absent controller */
>>>>>> +                       while (status&  SR_RBS&&  status != 0xFF) {
>>>>>>                                  sja1000_rx(dev);
>>>>>>                                  status = priv->read_reg(priv, REG_SR);
>>>>>>                          }
>>>>>>
>>>>>> @Stephane: Can you check that patch? I'm out of hw right now.
>>>>>
>>>>> I confirm that this patch works too...
>>>>> So I think I should be able to post a new version of the peak_pcmcia
>>>>> during that day (the previous should work but some calls to
>>>>> pcmcia_dev_present() are no more useful...)
>>>>
>>>> But that fix should not go to the common interrupt handler, if possible.
>>>
>>>
>>> Do you have an idea how to handle the while() statement without copying the
>>> entire interrupt handler code for the devices that might be unplugged?
>>>
>>> IMHO this patch is pretty cheap.
>>
>> I think it's enough to add a read in the custom pcmcia isr before
>> calling sja1000_interrupt(). Maybe the race window is a bit lower but we
>> are not able to react when the unplug happens anyway.
> 
> It's not about reacting when an unlug happens, it's about not having the
> interrupt handler to loop forever. At least we must limit the inner
> while loop.

Of course, the loop should be limited in sja1000_interrupt anyway.

Wolfgang.


  reply	other threads:[~2012-02-13 11:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-06 15:56 [PATCH v3] can/sja1000: add support for PEAK-System PCMCIA card Stephane Grosjean
2012-02-13  9:14 ` Marc Kleine-Budde
2012-02-13 10:01   ` Stephane Grosjean
2012-02-13 10:14     ` Wolfgang Grandegger
2012-02-13 10:41       ` Oliver Hartkopp
2012-02-13 11:02         ` Wolfgang Grandegger
2012-02-13 11:06           ` Marc Kleine-Budde
2012-02-13 11:08             ` Wolfgang Grandegger [this message]
2012-02-13 19:55               ` Oliver Hartkopp
2012-02-13 20:23                 ` Wolfgang Grandegger
2012-02-14  9:14                   ` Stephane Grosjean
2012-02-14  9:30                     ` Wolfgang Grandegger
2012-02-14  9:59                   ` Oliver Hartkopp
2012-02-14 10:16                     ` Stephane Grosjean
2012-02-14 16:41                       ` Oliver Hartkopp
2012-02-15  7:03                         ` Wolfgang Grandegger
2012-02-15  8:05                           ` Oliver Hartkopp
2012-02-15  8:37                             ` Wolfgang Grandegger
2012-02-15 19:32                               ` Oliver Hartkopp
2012-02-15 11:52                           ` Stephane Grosjean
2012-02-15 15:06                             ` Wolfgang Grandegger
2012-02-15 16:00                               ` Stephane Grosjean
2012-02-15 19:46                               ` Oliver Hartkopp
2012-02-13 10:46       ` Stephane Grosjean
2012-02-13 10:56         ` Wolfgang Grandegger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F38EF3A.7040907@grandegger.com \
    --to=wg@grandegger.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=s.grosjean@peak-system.com \
    --cc=socketcan@hartkopp.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).