aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-06-09 19:52:05 -0400
committerLen Brown <len.brown@intel.com>2008-06-11 19:13:46 -0400
commita993273beae8022390e48fe9205480565ad470ab (patch)
treebfe1529bb9104d85a812028dd3d014e063675409 /drivers/pnp
parente9fe9e188118a0a34c6200d9b10ea6247f53592d (diff)
pnpacpi: fix shareable IRQ encode/decode
When we encode IRQ resources, we should use the "shareable" flag we got from _PRS rather than guessing based on the IRQ trigger mode. This is based on a patch by Tom Jaeger: http://bugzilla.kernel.org/show_bug.cgi?id=9487#c32 Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index ab09fe6fe1e4..8681ff647201 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -50,14 +50,14 @@ static int irq_flags(int triggering, int polarity, int shareable)
50 flags = IORESOURCE_IRQ_HIGHEDGE; 50 flags = IORESOURCE_IRQ_HIGHEDGE;
51 } 51 }
52 52
53 if (shareable) 53 if (shareable == ACPI_SHARED)
54 flags |= IORESOURCE_IRQ_SHAREABLE; 54 flags |= IORESOURCE_IRQ_SHAREABLE;
55 55
56 return flags; 56 return flags;
57} 57}
58 58
59static void decode_irq_flags(struct pnp_dev *dev, int flags, int *triggering, 59static void decode_irq_flags(struct pnp_dev *dev, int flags, int *triggering,
60 int *polarity) 60 int *polarity, int *shareable)
61{ 61{
62 switch (flags & (IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_HIGHLEVEL | 62 switch (flags & (IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_HIGHLEVEL |
63 IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE)) { 63 IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE)) {
@@ -84,6 +84,11 @@ static void decode_irq_flags(struct pnp_dev *dev, int flags, int *triggering,
84 *polarity = ACPI_ACTIVE_HIGH; 84 *polarity = ACPI_ACTIVE_HIGH;
85 break; 85 break;
86 } 86 }
87
88 if (flags & IORESOURCE_IRQ_SHAREABLE)
89 *shareable = ACPI_SHARED;
90 else
91 *shareable = ACPI_EXCLUSIVE;
87} 92}
88 93
89static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, 94static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev,
@@ -796,15 +801,12 @@ static void pnpacpi_encode_irq(struct pnp_dev *dev,
796 struct resource *p) 801 struct resource *p)
797{ 802{
798 struct acpi_resource_irq *irq = &resource->data.irq; 803 struct acpi_resource_irq *irq = &resource->data.irq;
799 int triggering, polarity; 804 int triggering, polarity, shareable;
800 805
801 decode_irq_flags(dev, p->flags, &triggering, &polarity); 806 decode_irq_flags(dev, p->flags, &triggering, &polarity, &shareable);
802 irq->triggering = triggering; 807 irq->triggering = triggering;
803 irq->polarity = polarity; 808 irq->polarity = polarity;
804 if (triggering == ACPI_EDGE_SENSITIVE) 809 irq->sharable = shareable;
805 irq->sharable = ACPI_EXCLUSIVE;
806 else
807 irq->sharable = ACPI_SHARED;
808 irq->interrupt_count = 1; 810 irq->interrupt_count = 1;
809 irq->interrupts[0] = p->start; 811 irq->interrupts[0] = p->start;
810 812
@@ -819,16 +821,13 @@ static void pnpacpi_encode_ext_irq(struct pnp_dev *dev,
819 struct resource *p) 821 struct resource *p)
820{ 822{
821 struct acpi_resource_extended_irq *extended_irq = &resource->data.extended_irq; 823 struct acpi_resource_extended_irq *extended_irq = &resource->data.extended_irq;
822 int triggering, polarity; 824 int triggering, polarity, shareable;
823 825
824 decode_irq_flags(dev, p->flags, &triggering, &polarity); 826 decode_irq_flags(dev, p->flags, &triggering, &polarity, &shareable);
825 extended_irq->producer_consumer = ACPI_CONSUMER; 827 extended_irq->producer_consumer = ACPI_CONSUMER;
826 extended_irq->triggering = triggering; 828 extended_irq->triggering = triggering;
827 extended_irq->polarity = polarity; 829 extended_irq->polarity = polarity;
828 if (triggering == ACPI_EDGE_SENSITIVE) 830 extended_irq->sharable = shareable;
829 extended_irq->sharable = ACPI_EXCLUSIVE;
830 else
831 extended_irq->sharable = ACPI_SHARED;
832 extended_irq->interrupt_count = 1; 831 extended_irq->interrupt_count = 1;
833 extended_irq->interrupts[0] = p->start; 832 extended_irq->interrupts[0] = p->start;
834 833