public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Russell King <rmk+lkml@arm.linux.org.uk>,
	Andrew Morton <akpm@osdl.org>,
	Andreas Mohr <andi@rhlx01.fht-esslingen.de>,
	florin@iucha.net, linux-kernel@vger.kernel.org,
	linux@dominikbrodowski.net
Subject: Re: pcmcia oops on 2.6.17-rc[12]
Date: Tue, 16 May 2006 16:16:44 +0100	[thread overview]
Message-ID: <1147792604.2151.66.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.64.0605151629350.3866@g5.osdl.org>

On Llu, 2006-05-15 at 16:37 -0700, Linus Torvalds wrote:
> ISA design. And PCMCIA is no longer an excuse, exactly because of some 
> systems that will route even the 16-bit interrupts through a PCI irq.

The patch below cleans up the pcmcia code a bit on the IRQ side (I did
this while debugging the problem just so I could read wtf it was doing),
and also adds a warning and passes back the correct information when a
device asks for exclusive but gets given shared. This at least means the
dmesg dump of a problem triggered by this will have a signature to find.

Alan

Signed-off-by: Alan Cox <alan@redhat.com>


diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.17-rc4/drivers/pcmcia/pcmcia_resource.c linux-2.6.17-rc4/drivers/pcmcia/pcmcia_resource.c
--- linux.vanilla-2.6.17-rc4/drivers/pcmcia/pcmcia_resource.c	2006-05-15 15:46:04.000000000 +0100
+++ linux-2.6.17-rc4/drivers/pcmcia/pcmcia_resource.c	2006-05-16 14:59:42.000000000 +0100
@@ -788,6 +788,7 @@
 	struct pcmcia_socket *s = p_dev->socket;
 	config_t *c;
 	int ret = CS_IN_USE, irq = 0;
+	int type;
 
 	if (!(s->state & SOCKET_PRESENT))
 		return CS_NO_CARD;
@@ -797,6 +798,13 @@
 	if (c->state & CONFIG_IRQ_REQ)
 		return CS_IN_USE;
 
+	/* Decide what type of interrupt we are registering */
+	type = 0;
+	if (s->functions > 1)		/* All of this ought to be handled higher up */
+		type = SA_SHIRQ;
+	if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)
+		type = SA_SHIRQ;
+	
 #ifdef CONFIG_PCMCIA_PROBE
 	if (s->irq.AssignedIRQ != 0) {
 		/* If the interrupt is already assigned, it must be the same */
@@ -822,9 +830,7 @@
 			 * marked as used by the kernel resource management core */
 			ret = request_irq(irq,
 					  (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Handler : test_action,
-					  ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) ||
-					   (s->functions > 1) ||
-					   (irq == s->pci_irq)) ? SA_SHIRQ : 0,
+					  type, 
 					  p_dev->devname,
 					  (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Instance : data);
 			if (!ret) {
@@ -839,18 +845,21 @@
 	if (ret && !s->irq.AssignedIRQ) {
 		if (!s->pci_irq)
 			return ret;
+		type = SA_SHIRQ;
 		irq = s->pci_irq;
 	}
 
-	if (ret && req->Attributes & IRQ_HANDLE_PRESENT) {
-		if (request_irq(irq, req->Handler,
-				((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) ||
-				 (s->functions > 1) ||
-				 (irq == s->pci_irq)) ? SA_SHIRQ : 0,
-				p_dev->devname, req->Instance))
+	if (ret && (req->Attributes & IRQ_HANDLE_PRESENT)) {
+		if (request_irq(irq, req->Handler, type,  p_dev->devname, req->Instance))
 			return CS_IN_USE;
 	}
 
+	/* Make sure the fact the request type was overridden is passed back */
+	if (type == SA_SHIRQ && !(req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)) {
+		req->Attributes |= IRQ_TYPE_DYNAMIC_SHARING;
+		printk(KERN_WARNING "pcmcia: request for exclusive IRQ could not be fulfilled.\n");
+		printk(KERN_WARNING "pcmcia: the driver needs updating to supported shared IRQ lines.\n");
+	}
 	c->irq.Attributes = req->Attributes;
 	s->irq.AssignedIRQ = req->AssignedIRQ = irq;
 	s->irq.Config++;


  parent reply	other threads:[~2006-05-16 15:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-23 19:22 pcmcia oops on 2.6.17-rc[12] Florin Iucha
2006-04-23 22:02 ` Andrew Morton
2006-04-23 22:15   ` Randy.Dunlap
2006-04-24  0:46   ` Florin Iucha
2006-05-08 14:56   ` Andreas Mohr
2006-05-08 15:43     ` Andrew Morton
2006-05-08 16:34       ` Russell King
2006-05-15 22:07         ` Alan Cox
2006-05-15 22:00           ` Russell King
2006-05-18 11:10             ` Russell King
2006-05-15 22:02           ` Linus Torvalds
2006-05-15 23:00             ` Alan Cox
2006-05-15 23:37               ` Linus Torvalds
2006-05-15 23:52                 ` Linus Torvalds
2006-05-16  0:17                   ` Alan Cox
2006-05-16  0:18                     ` Linus Torvalds
2006-05-16  1:18                       ` Alan Cox
2006-05-16 15:16                 ` Alan Cox [this message]
2006-05-22 11:50               ` Rogier Wolff
2006-05-22 12:10                 ` Alan Cox
2006-05-22 21:27                   ` Rogier Wolff
2006-05-22 22:38                     ` Alan Cox
2006-06-02 19:09                   ` Russell King
2006-05-22 15:06                 ` Linus Torvalds

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=1147792604.2151.66.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=akpm@osdl.org \
    --cc=andi@rhlx01.fht-esslingen.de \
    --cc=florin@iucha.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=rmk+lkml@arm.linux.org.uk \
    --cc=torvalds@osdl.org \
    /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