diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pnp/base.h | 12 | ||||
-rw-r--r-- | drivers/pnp/manager.c | 16 | ||||
-rw-r--r-- | drivers/pnp/resource.c | 8 |
3 files changed, 20 insertions, 16 deletions
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h index b888a5fb6b7f..1d6bb351d323 100644 --- a/drivers/pnp/base.h +++ b/drivers/pnp/base.h | |||
@@ -26,9 +26,13 @@ void pnp_init_resource(struct resource *res); | |||
26 | #define PNP_MAX_IRQ 2 | 26 | #define PNP_MAX_IRQ 2 |
27 | #define PNP_MAX_DMA 2 | 27 | #define PNP_MAX_DMA 2 |
28 | 28 | ||
29 | struct pnp_resource { | ||
30 | struct resource res; | ||
31 | }; | ||
32 | |||
29 | struct pnp_resource_table { | 33 | struct pnp_resource_table { |
30 | struct resource port_resource[PNP_MAX_PORT]; | 34 | struct pnp_resource port[PNP_MAX_PORT]; |
31 | struct resource mem_resource[PNP_MAX_MEM]; | 35 | struct pnp_resource mem[PNP_MAX_MEM]; |
32 | struct resource dma_resource[PNP_MAX_DMA]; | 36 | struct pnp_resource dma[PNP_MAX_DMA]; |
33 | struct resource irq_resource[PNP_MAX_IRQ]; | 37 | struct pnp_resource irq[PNP_MAX_IRQ]; |
34 | }; | 38 | }; |
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 46a5e0e90d9a..4823da27e640 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
@@ -247,22 +247,22 @@ void pnp_init_resources(struct pnp_dev *dev) | |||
247 | int idx; | 247 | int idx; |
248 | 248 | ||
249 | for (idx = 0; idx < PNP_MAX_IRQ; idx++) { | 249 | for (idx = 0; idx < PNP_MAX_IRQ; idx++) { |
250 | res = &dev->res->irq_resource[idx]; | 250 | res = &dev->res->irq[idx].res; |
251 | res->flags = IORESOURCE_IRQ; | 251 | res->flags = IORESOURCE_IRQ; |
252 | pnp_init_resource(res); | 252 | pnp_init_resource(res); |
253 | } | 253 | } |
254 | for (idx = 0; idx < PNP_MAX_DMA; idx++) { | 254 | for (idx = 0; idx < PNP_MAX_DMA; idx++) { |
255 | res = &dev->res->dma_resource[idx]; | 255 | res = &dev->res->dma[idx].res; |
256 | res->flags = IORESOURCE_DMA; | 256 | res->flags = IORESOURCE_DMA; |
257 | pnp_init_resource(res); | 257 | pnp_init_resource(res); |
258 | } | 258 | } |
259 | for (idx = 0; idx < PNP_MAX_PORT; idx++) { | 259 | for (idx = 0; idx < PNP_MAX_PORT; idx++) { |
260 | res = &dev->res->port_resource[idx]; | 260 | res = &dev->res->port[idx].res; |
261 | res->flags = IORESOURCE_IO; | 261 | res->flags = IORESOURCE_IO; |
262 | pnp_init_resource(res); | 262 | pnp_init_resource(res); |
263 | } | 263 | } |
264 | for (idx = 0; idx < PNP_MAX_MEM; idx++) { | 264 | for (idx = 0; idx < PNP_MAX_MEM; idx++) { |
265 | res = &dev->res->mem_resource[idx]; | 265 | res = &dev->res->mem[idx].res; |
266 | res->flags = IORESOURCE_MEM; | 266 | res->flags = IORESOURCE_MEM; |
267 | pnp_init_resource(res); | 267 | pnp_init_resource(res); |
268 | } | 268 | } |
@@ -278,28 +278,28 @@ static void pnp_clean_resource_table(struct pnp_dev *dev) | |||
278 | int idx; | 278 | int idx; |
279 | 279 | ||
280 | for (idx = 0; idx < PNP_MAX_IRQ; idx++) { | 280 | for (idx = 0; idx < PNP_MAX_IRQ; idx++) { |
281 | res = &dev->res->irq_resource[idx]; | 281 | res = &dev->res->irq[idx].res; |
282 | if (res->flags & IORESOURCE_AUTO) { | 282 | if (res->flags & IORESOURCE_AUTO) { |
283 | res->flags = IORESOURCE_IRQ; | 283 | res->flags = IORESOURCE_IRQ; |
284 | pnp_init_resource(res); | 284 | pnp_init_resource(res); |
285 | } | 285 | } |
286 | } | 286 | } |
287 | for (idx = 0; idx < PNP_MAX_DMA; idx++) { | 287 | for (idx = 0; idx < PNP_MAX_DMA; idx++) { |
288 | res = &dev->res->dma_resource[idx]; | 288 | res = &dev->res->dma[idx].res; |
289 | if (res->flags & IORESOURCE_AUTO) { | 289 | if (res->flags & IORESOURCE_AUTO) { |
290 | res->flags = IORESOURCE_DMA; | 290 | res->flags = IORESOURCE_DMA; |
291 | pnp_init_resource(res); | 291 | pnp_init_resource(res); |
292 | } | 292 | } |
293 | } | 293 | } |
294 | for (idx = 0; idx < PNP_MAX_PORT; idx++) { | 294 | for (idx = 0; idx < PNP_MAX_PORT; idx++) { |
295 | res = &dev->res->port_resource[idx]; | 295 | res = &dev->res->port[idx].res; |
296 | if (res->flags & IORESOURCE_AUTO) { | 296 | if (res->flags & IORESOURCE_AUTO) { |
297 | res->flags = IORESOURCE_IO; | 297 | res->flags = IORESOURCE_IO; |
298 | pnp_init_resource(res); | 298 | pnp_init_resource(res); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | for (idx = 0; idx < PNP_MAX_MEM; idx++) { | 301 | for (idx = 0; idx < PNP_MAX_MEM; idx++) { |
302 | res = &dev->res->mem_resource[idx]; | 302 | res = &dev->res->mem[idx].res; |
303 | if (res->flags & IORESOURCE_AUTO) { | 303 | if (res->flags & IORESOURCE_AUTO) { |
304 | res->flags = IORESOURCE_MEM; | 304 | res->flags = IORESOURCE_MEM; |
305 | pnp_init_resource(res); | 305 | pnp_init_resource(res); |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index f7adc7eefbf8..7e9f4300e5f6 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -508,19 +508,19 @@ struct resource *pnp_get_resource(struct pnp_dev *dev, | |||
508 | case IORESOURCE_IO: | 508 | case IORESOURCE_IO: |
509 | if (num >= PNP_MAX_PORT) | 509 | if (num >= PNP_MAX_PORT) |
510 | return NULL; | 510 | return NULL; |
511 | return &res->port_resource[num]; | 511 | return &res->port[num].res; |
512 | case IORESOURCE_MEM: | 512 | case IORESOURCE_MEM: |
513 | if (num >= PNP_MAX_MEM) | 513 | if (num >= PNP_MAX_MEM) |
514 | return NULL; | 514 | return NULL; |
515 | return &res->mem_resource[num]; | 515 | return &res->mem[num].res; |
516 | case IORESOURCE_IRQ: | 516 | case IORESOURCE_IRQ: |
517 | if (num >= PNP_MAX_IRQ) | 517 | if (num >= PNP_MAX_IRQ) |
518 | return NULL; | 518 | return NULL; |
519 | return &res->irq_resource[num]; | 519 | return &res->irq[num].res; |
520 | case IORESOURCE_DMA: | 520 | case IORESOURCE_DMA: |
521 | if (num >= PNP_MAX_DMA) | 521 | if (num >= PNP_MAX_DMA) |
522 | return NULL; | 522 | return NULL; |
523 | return &res->dma_resource[num]; | 523 | return &res->dma[num].res; |
524 | } | 524 | } |
525 | return NULL; | 525 | return NULL; |
526 | } | 526 | } |