Skip to contentSkip to conversation

pcmcia: irq probe can be done without risking an IRQ storm

PATCH In review Alan Cox 3 participants 4 messages Apr 5, 2007 – Apr 26, 2007 Pcmcia

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 pcmcia: irq probe can be done without risking an IRQ storm

Nowdays you can ask for an IRQ to be allocated but not enabled, when PCMCIA was written this was not true and this feature is thus not used

drivers/pcmcia/pcmcia_resource.c +3 -0
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.21-rc5-mm4/drivers/pcmcia/pcmcia_resource.c linux-2.6.21-rc5-mm4/drivers/pcmcia/pcmcia_resource.c
@@ -810,8 +810,11 @@
 		type = IRQF_SHARED;
 	if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)
 		type = IRQF_SHARED;	
 #ifdef CONFIG_PCMCIA_PROBE
+	if (!(req->Attributes & IRQ_HANDLE_PRESENT))
+		type |= IRQ_NOAUTOEN;
+
 	if (s->irq.AssignedIRQ != 0) {
 		/* If the interrupt is already assigned, it must be the same */
 		irq = s->irq.AssignedIRQ;
#1 lore raw
Quoted 9 lines · On Thu, 5 Apr 2007 14:09:36 +0100 Alan Cox <[email protected]> wrote:

Nowdays you can ask for an IRQ to be allocated but not enabled, when PCMCIA was written this was not true and this feature is thus not used

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.21-rc5-mm4/drivers/pcmcia/pcmcia_resource.c linux-2.6.21-rc5-mm4/drivers/pcmcia/pcmcia_resource.c

drivers/pcmcia/pcmcia_resource.c line 819

Quoted 10 lines
drivers/pcmcia/pcmcia_resource.c +3 -0
@@ -810,8 +810,11 @@
 		type = IRQF_SHARED;
 	if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)
 		type = IRQF_SHARED;	
 #ifdef CONFIG_PCMCIA_PROBE
+	if (!(req->Attributes & IRQ_HANDLE_PRESENT))
+		type |= IRQ_NOAUTOEN;
+
 	if (s->irq.AssignedIRQ != 0) {
 		/* If the interrupt is already assigned, it must be the same */
 		irq = s->irq.AssignedIRQ;

alpha:

drivers/pcmcia/pcmcia_resource.c: In function 'pcmcia_request_irq':
drivers/pcmcia/pcmcia_resource.c:816: error: 'IRQ_NOAUTOEN' undeclared (first use in this function) drivers/pcmcia/pcmcia_resource.c:816: error: (Each undeclared identifier is reported only once drivers/pcmcia/pcmcia_resource.c:816: error: for each function it appears in.)

Problem is, IRQ_NOAUTOEN is a generic-irq thing, so architectures which don't use generic-irqs break. And it's defined in linux/irq.h which (stupidly) cannot be included in generic code.

#2 lore raw
Quoted 24 lines · Andrew Morton
Quoted 9 lines · On Thu, 5 Apr 2007 14:09:36 +0100 Alan Cox <[email protected]> wrote:

Nowdays you can ask for an IRQ to be allocated but not enabled, when PCMCIA was written this was not true and this feature is thus not used

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.21-rc5-mm4/drivers/pcmcia/pcmcia_resource.c linux-2.6.21-rc5-mm4/drivers/pcmcia/pcmcia_resource.c

drivers/pcmcia/pcmcia_resource.c line 819

Quoted 10 lines
drivers/pcmcia/pcmcia_resource.c +3 -0
@@ -810,8 +810,11 @@
 		type = IRQF_SHARED;
 	if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)
 		type = IRQF_SHARED;	
 #ifdef CONFIG_PCMCIA_PROBE
+	if (!(req->Attributes & IRQ_HANDLE_PRESENT))
+		type |= IRQ_NOAUTOEN;
+
 	if (s->irq.AssignedIRQ != 0) {
 		/* If the interrupt is already assigned, it must be the same */
 		irq = s->irq.AssignedIRQ;

alpha:

Quoted 8 lines

drivers/pcmcia/pcmcia_resource.c: In function 'pcmcia_request_irq':
drivers/pcmcia/pcmcia_resource.c:816: error: 'IRQ_NOAUTOEN' undeclared (first use in this function) drivers/pcmcia/pcmcia_resource.c:816: error: (Each undeclared identifier is reported only once drivers/pcmcia/pcmcia_resource.c:816: error: for each function it appears in.)

Problem is, IRQ_NOAUTOEN is a generic-irq thing, so architectures which don't use generic-irqs break. And it's defined in linux/irq.h which (stupidly) cannot be included in generic code.

Hrmpf. We need a IRQF_NOAUTOEN, which can be handed to reqeust_irq().

I cook a patch.

tglx

#3 lore raw
Quoted 15 lines · Thomas Gleixner
Quoted 15 lines

drivers/pcmcia/pcmcia_resource.c line 819

Quoted 7 lines

#ifdef CONFIG_PCMCIA_PROBE

drivers/pcmcia/pcmcia_resource.c +3 -0
+	if (!(req->Attributes & IRQ_HANDLE_PRESENT))
+		type |= IRQ_NOAUTOEN;
+
 	if (s->irq.AssignedIRQ != 0) {
 		/* If the interrupt is already assigned, it must be the same */
 		irq = s->irq.AssignedIRQ;

alpha:

drivers/pcmcia/pcmcia_resource.c: In function 'pcmcia_request_irq':
drivers/pcmcia/pcmcia_resource.c:816: error: 'IRQ_NOAUTOEN' undeclared (first use in this function) drivers/pcmcia/pcmcia_resource.c:816: error: (Each undeclared identifier is reported only once drivers/pcmcia/pcmcia_resource.c:816: error: for each function it appears in.)

Quoted 7 lines
Quoted 3 lines

Problem is, IRQ_NOAUTOEN is a generic-irq thing, so architectures which don't use generic-irqs break. And it's defined in linux/irq.h which (stupidly) cannot be included in generic code.

Hrmpf. We need a IRQF_NOAUTOEN, which can be handed to reqeust_irq().

I cook a patch.

Not that simple. For non shared interrupts it is straight forward, but for shared ones we have to decide, whether we

A) reject the request
B) disable the interrupt and rely on the caller, that it reenables it
C) ignore it

sorted by ugliness order :)

A) is definitely the most safe bet, but B) might work as well.

tglx