diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:02 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:18 -0400 |
commit | cd7ec927d9cd3d2001cbbdce872bd73f6e49c986 (patch) | |
tree | 33ed9035c8404b21848a8fff9e4cf8a70d791f3a /drivers/pnp | |
parent | bb84b41d1a1e3ad1ebe7f91a7c97d3b6ca242e9d (diff) |
PNPACPI: extend irq_flags() to set IORESOURCE_IRQ_SHAREABLE when appropriate
This simplifies IRQ resource parsing slightly by computing all the
IORESOURCE_IRQ_* flags at the same time.
This also keeps track of shareability information when parsing options
from _PRS. Previously we ignored shareability in _PRS.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-By: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 2a47e977d8a8..a5f5e2130e75 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -32,19 +32,26 @@ | |||
32 | /* | 32 | /* |
33 | * Allocated Resources | 33 | * Allocated Resources |
34 | */ | 34 | */ |
35 | static int irq_flags(int triggering, int polarity) | 35 | static int irq_flags(int triggering, int polarity, int shareable) |
36 | { | 36 | { |
37 | int flags; | ||
38 | |||
37 | if (triggering == ACPI_LEVEL_SENSITIVE) { | 39 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
38 | if (polarity == ACPI_ACTIVE_LOW) | 40 | if (polarity == ACPI_ACTIVE_LOW) |
39 | return IORESOURCE_IRQ_LOWLEVEL; | 41 | flags = IORESOURCE_IRQ_LOWLEVEL; |
40 | else | 42 | else |
41 | return IORESOURCE_IRQ_HIGHLEVEL; | 43 | flags = IORESOURCE_IRQ_HIGHLEVEL; |
42 | } else { | 44 | } else { |
43 | if (polarity == ACPI_ACTIVE_LOW) | 45 | if (polarity == ACPI_ACTIVE_LOW) |
44 | return IORESOURCE_IRQ_LOWEDGE; | 46 | flags = IORESOURCE_IRQ_LOWEDGE; |
45 | else | 47 | else |
46 | return IORESOURCE_IRQ_HIGHEDGE; | 48 | flags = IORESOURCE_IRQ_HIGHEDGE; |
47 | } | 49 | } |
50 | |||
51 | if (shareable) | ||
52 | flags |= IORESOURCE_IRQ_SHAREABLE; | ||
53 | |||
54 | return flags; | ||
48 | } | 55 | } |
49 | 56 | ||
50 | static void decode_irq_flags(int flag, int *triggering, int *polarity) | 57 | static void decode_irq_flags(int flag, int *triggering, int *polarity) |
@@ -110,16 +117,13 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
110 | } | 117 | } |
111 | 118 | ||
112 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 119 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
113 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); | 120 | res->irq_resource[i].flags |= irq_flags(triggering, polarity, shareable); |
114 | irq = acpi_register_gsi(gsi, triggering, polarity); | 121 | irq = acpi_register_gsi(gsi, triggering, polarity); |
115 | if (irq < 0) { | 122 | if (irq < 0) { |
116 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; | 123 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; |
117 | return; | 124 | return; |
118 | } | 125 | } |
119 | 126 | ||
120 | if (shareable) | ||
121 | res->irq_resource[i].flags |= IORESOURCE_IRQ_SHAREABLE; | ||
122 | |||
123 | res->irq_resource[i].start = irq; | 127 | res->irq_resource[i].start = irq; |
124 | res->irq_resource[i].end = irq; | 128 | res->irq_resource[i].end = irq; |
125 | pcibios_penalize_isa_irq(irq, 1); | 129 | pcibios_penalize_isa_irq(irq, 1); |
@@ -441,7 +445,7 @@ static __init void pnpacpi_parse_irq_option(struct pnp_option *option, | |||
441 | for (i = 0; i < p->interrupt_count; i++) | 445 | for (i = 0; i < p->interrupt_count; i++) |
442 | if (p->interrupts[i]) | 446 | if (p->interrupts[i]) |
443 | __set_bit(p->interrupts[i], irq->map); | 447 | __set_bit(p->interrupts[i], irq->map); |
444 | irq->flags = irq_flags(p->triggering, p->polarity); | 448 | irq->flags = irq_flags(p->triggering, p->polarity, p->sharable); |
445 | 449 | ||
446 | pnp_register_irq_resource(option, irq); | 450 | pnp_register_irq_resource(option, irq); |
447 | } | 451 | } |
@@ -461,7 +465,7 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_option *option, | |||
461 | for (i = 0; i < p->interrupt_count; i++) | 465 | for (i = 0; i < p->interrupt_count; i++) |
462 | if (p->interrupts[i]) | 466 | if (p->interrupts[i]) |
463 | __set_bit(p->interrupts[i], irq->map); | 467 | __set_bit(p->interrupts[i], irq->map); |
464 | irq->flags = irq_flags(p->triggering, p->polarity); | 468 | irq->flags = irq_flags(p->triggering, p->polarity, p->sharable); |
465 | 469 | ||
466 | pnp_register_irq_resource(option, irq); | 470 | pnp_register_irq_resource(option, irq); |
467 | } | 471 | } |