aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:30 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:27 -0400
commit784f01d5bdeae7d7005ede17305306b042ba2617 (patch)
tree5723e4bde087657b86bda865ac249b42a5c6a9cf /drivers
parent06cb58a6eb0b689f95a6c055cfc400fd30c500c6 (diff)
PNP: add struct pnp_resource
This patch adds a "struct pnp_resource". This currently contains only a struct resource, but we will soon need additional PNP-specific information. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pnp/base.h12
-rw-r--r--drivers/pnp/manager.c16
-rw-r--r--drivers/pnp/resource.c8
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
29struct pnp_resource {
30 struct resource res;
31};
32
29struct pnp_resource_table { 33struct 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}