aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:34 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:28 -0400
commitdbddd0383c59d588f8db5e773b062756e39117ec (patch)
tree77009fb218b4fc21090ae83105aa0f84664ae61c /drivers/pnp/pnpacpi
parenta50b6d7b8d7e1a8b13bd1be65a865b115e1190d9 (diff)
PNP: make generic pnp_add_irq_resource()
Add a pnp_add_irq_resource() that can be used by all the PNP backends. This consolidates a little more pnp_resource_table knowledge into one place. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 3634f2f3f745..0b67dff1e7c3 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -82,28 +82,12 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev,
82 u32 gsi, int triggering, 82 u32 gsi, int triggering,
83 int polarity, int shareable) 83 int polarity, int shareable)
84{ 84{
85 struct resource *res; 85 int irq, flags;
86 int i;
87 int irq;
88 int p, t; 86 int p, t;
89 static unsigned char warned;
90 87
91 if (!valid_IRQ(gsi)) 88 if (!valid_IRQ(gsi))
92 return; 89 return;
93 90
94 for (i = 0; i < PNP_MAX_IRQ; i++) {
95 res = pnp_get_resource(dev, IORESOURCE_IRQ, i);
96 if (!pnp_resource_valid(res))
97 break;
98 }
99 if (i >= PNP_MAX_IRQ) {
100 if (!warned) {
101 printk(KERN_WARNING "pnpacpi: exceeded the max number"
102 " of IRQ resources: %d\n", PNP_MAX_IRQ);
103 warned = 1;
104 }
105 return;
106 }
107 /* 91 /*
108 * in IO-APIC mode, use overrided attribute. Two reasons: 92 * in IO-APIC mode, use overrided attribute. Two reasons:
109 * 1. BIOS bug in DSDT 93 * 1. BIOS bug in DSDT
@@ -121,17 +105,14 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev,
121 } 105 }
122 } 106 }
123 107
124 res->flags = IORESOURCE_IRQ; // Also clears _UNSET flag 108 flags = irq_flags(triggering, polarity, shareable);
125 res->flags |= irq_flags(triggering, polarity, shareable);
126 irq = acpi_register_gsi(gsi, triggering, polarity); 109 irq = acpi_register_gsi(gsi, triggering, polarity);
127 if (irq < 0) { 110 if (irq >= 0)
128 res->flags |= IORESOURCE_DISABLED; 111 pcibios_penalize_isa_irq(irq, 1);
129 return; 112 else
130 } 113 flags |= IORESOURCE_DISABLED;
131 114
132 res->start = irq; 115 pnp_add_irq_resource(dev, irq, flags);
133 res->end = irq;
134 pcibios_penalize_isa_irq(irq, 1);
135} 116}
136 117
137static int dma_flags(int type, int bus_master, int transfer) 118static int dma_flags(int type, int bus_master, int transfer)