aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:29 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:27 -0400
commit06cb58a6eb0b689f95a6c055cfc400fd30c500c6 (patch)
treeb2b2cc2ac421091be7949315b6ffde6426466700 /drivers/pnp/pnpacpi
parent02d83b5da3efa3c278ce87db2637f3dd6837166d (diff)
PNP: remove pnp_resource_table references from resource decoders
This removes a few more references to the pnp_resource_table. No functional change. 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.c88
1 files changed, 48 insertions, 40 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 2669518b4795..3634f2f3f745 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -82,8 +82,8 @@ 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 pnp_resource_table *res = dev->res; 85 struct resource *res;
86 int i = 0; 86 int i;
87 int irq; 87 int irq;
88 int p, t; 88 int p, t;
89 static unsigned char warned; 89 static unsigned char warned;
@@ -91,9 +91,11 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev,
91 if (!valid_IRQ(gsi)) 91 if (!valid_IRQ(gsi))
92 return; 92 return;
93 93
94 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && 94 for (i = 0; i < PNP_MAX_IRQ; i++) {
95 i < PNP_MAX_IRQ) 95 res = pnp_get_resource(dev, IORESOURCE_IRQ, i);
96 i++; 96 if (!pnp_resource_valid(res))
97 break;
98 }
97 if (i >= PNP_MAX_IRQ) { 99 if (i >= PNP_MAX_IRQ) {
98 if (!warned) { 100 if (!warned) {
99 printk(KERN_WARNING "pnpacpi: exceeded the max number" 101 printk(KERN_WARNING "pnpacpi: exceeded the max number"
@@ -119,16 +121,16 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev,
119 } 121 }
120 } 122 }
121 123
122 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag 124 res->flags = IORESOURCE_IRQ; // Also clears _UNSET flag
123 res->irq_resource[i].flags |= irq_flags(triggering, polarity, shareable); 125 res->flags |= irq_flags(triggering, polarity, shareable);
124 irq = acpi_register_gsi(gsi, triggering, polarity); 126 irq = acpi_register_gsi(gsi, triggering, polarity);
125 if (irq < 0) { 127 if (irq < 0) {
126 res->irq_resource[i].flags |= IORESOURCE_DISABLED; 128 res->flags |= IORESOURCE_DISABLED;
127 return; 129 return;
128 } 130 }
129 131
130 res->irq_resource[i].start = irq; 132 res->start = irq;
131 res->irq_resource[i].end = irq; 133 res->end = irq;
132 pcibios_penalize_isa_irq(irq, 1); 134 pcibios_penalize_isa_irq(irq, 1);
133} 135}
134 136
@@ -178,22 +180,24 @@ static int dma_flags(int type, int bus_master, int transfer)
178static void pnpacpi_parse_allocated_dmaresource(struct pnp_dev *dev, 180static void pnpacpi_parse_allocated_dmaresource(struct pnp_dev *dev,
179 u32 dma, int flags) 181 u32 dma, int flags)
180{ 182{
181 struct pnp_resource_table *res = dev->res; 183 struct resource *res;
182 int i = 0; 184 int i;
183 static unsigned char warned; 185 static unsigned char warned;
184 186
185 while (i < PNP_MAX_DMA && 187 for (i = 0; i < PNP_MAX_DMA; i++) {
186 !(res->dma_resource[i].flags & IORESOURCE_UNSET)) 188 res = pnp_get_resource(dev, IORESOURCE_DMA, i);
187 i++; 189 if (!pnp_resource_valid(res))
190 break;
191 }
188 if (i < PNP_MAX_DMA) { 192 if (i < PNP_MAX_DMA) {
189 res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag 193 res->flags = IORESOURCE_DMA; // Also clears _UNSET flag
190 res->dma_resource[i].flags |= flags; 194 res->flags |= flags;
191 if (dma == -1) { 195 if (dma == -1) {
192 res->dma_resource[i].flags |= IORESOURCE_DISABLED; 196 res->flags |= IORESOURCE_DISABLED;
193 return; 197 return;
194 } 198 }
195 res->dma_resource[i].start = dma; 199 res->start = dma;
196 res->dma_resource[i].end = dma; 200 res->end = dma;
197 } else if (!warned) { 201 } else if (!warned) {
198 printk(KERN_WARNING "pnpacpi: exceeded the max number of DMA " 202 printk(KERN_WARNING "pnpacpi: exceeded the max number of DMA "
199 "resources: %d \n", PNP_MAX_DMA); 203 "resources: %d \n", PNP_MAX_DMA);
@@ -204,23 +208,25 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_dev *dev,
204static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, 208static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev,
205 u64 io, u64 len, int io_decode) 209 u64 io, u64 len, int io_decode)
206{ 210{
207 struct pnp_resource_table *res = dev->res; 211 struct resource *res;
208 int i = 0; 212 int i;
209 static unsigned char warned; 213 static unsigned char warned;
210 214
211 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && 215 for (i = 0; i < PNP_MAX_PORT; i++) {
212 i < PNP_MAX_PORT) 216 res = pnp_get_resource(dev, IORESOURCE_IO, i);
213 i++; 217 if (!pnp_resource_valid(res))
218 break;
219 }
214 if (i < PNP_MAX_PORT) { 220 if (i < PNP_MAX_PORT) {
215 res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag 221 res->flags = IORESOURCE_IO; // Also clears _UNSET flag
216 if (io_decode == ACPI_DECODE_16) 222 if (io_decode == ACPI_DECODE_16)
217 res->port_resource[i].flags |= PNP_PORT_FLAG_16BITADDR; 223 res->flags |= PNP_PORT_FLAG_16BITADDR;
218 if (len <= 0 || (io + len - 1) >= 0x10003) { 224 if (len <= 0 || (io + len - 1) >= 0x10003) {
219 res->port_resource[i].flags |= IORESOURCE_DISABLED; 225 res->flags |= IORESOURCE_DISABLED;
220 return; 226 return;
221 } 227 }
222 res->port_resource[i].start = io; 228 res->start = io;
223 res->port_resource[i].end = io + len - 1; 229 res->end = io + len - 1;
224 } else if (!warned) { 230 } else if (!warned) {
225 printk(KERN_WARNING "pnpacpi: exceeded the max number of IO " 231 printk(KERN_WARNING "pnpacpi: exceeded the max number of IO "
226 "resources: %d \n", PNP_MAX_PORT); 232 "resources: %d \n", PNP_MAX_PORT);
@@ -232,24 +238,26 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev,
232 u64 mem, u64 len, 238 u64 mem, u64 len,
233 int write_protect) 239 int write_protect)
234{ 240{
235 struct pnp_resource_table *res = dev->res; 241 struct resource *res;
236 int i = 0; 242 int i;
237 static unsigned char warned; 243 static unsigned char warned;
238 244
239 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && 245 for (i = 0; i < PNP_MAX_MEM; i++) {
240 (i < PNP_MAX_MEM)) 246 res = pnp_get_resource(dev, IORESOURCE_MEM, i);
241 i++; 247 if (!pnp_resource_valid(res))
248 break;
249 }
242 if (i < PNP_MAX_MEM) { 250 if (i < PNP_MAX_MEM) {
243 res->mem_resource[i].flags = IORESOURCE_MEM; // Also clears _UNSET flag 251 res->flags = IORESOURCE_MEM; // Also clears _UNSET flag
244 if (len <= 0) { 252 if (len <= 0) {
245 res->mem_resource[i].flags |= IORESOURCE_DISABLED; 253 res->flags |= IORESOURCE_DISABLED;
246 return; 254 return;
247 } 255 }
248 if (write_protect == ACPI_READ_WRITE_MEMORY) 256 if (write_protect == ACPI_READ_WRITE_MEMORY)
249 res->mem_resource[i].flags |= IORESOURCE_MEM_WRITEABLE; 257 res->flags |= IORESOURCE_MEM_WRITEABLE;
250 258
251 res->mem_resource[i].start = mem; 259 res->start = mem;
252 res->mem_resource[i].end = mem + len - 1; 260 res->end = mem + len - 1;
253 } else if (!warned) { 261 } else if (!warned) {
254 printk(KERN_WARNING "pnpacpi: exceeded the max number of mem " 262 printk(KERN_WARNING "pnpacpi: exceeded the max number of mem "
255 "resources: %d\n", PNP_MAX_MEM); 263 "resources: %d\n", PNP_MAX_MEM);