diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 16:34:30 -0600 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:27 -0400 |
commit | 784f01d5bdeae7d7005ede17305306b042ba2617 (patch) | |
tree | 5723e4bde087657b86bda865ac249b42a5c6a9cf /drivers/pnp | |
parent | 06cb58a6eb0b689f95a6c055cfc400fd30c500c6 (diff) | |
download | kernel_samsung_smdk4412-784f01d5bdeae7d7005ede17305306b042ba2617.zip kernel_samsung_smdk4412-784f01d5bdeae7d7005ede17305306b042ba2617.tar.gz kernel_samsung_smdk4412-784f01d5bdeae7d7005ede17305306b042ba2617.tar.bz2 |
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/pnp')
-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 b888a5f..1d6bb35 100644 --- a/drivers/pnp/base.h +++ b/drivers/pnp/base.h @@ -26,9 +26,13 @@ void pnp_init_resource(struct resource *res); #define PNP_MAX_IRQ 2 #define PNP_MAX_DMA 2 +struct pnp_resource { + struct resource res; +}; + struct pnp_resource_table { - struct resource port_resource[PNP_MAX_PORT]; - struct resource mem_resource[PNP_MAX_MEM]; - struct resource dma_resource[PNP_MAX_DMA]; - struct resource irq_resource[PNP_MAX_IRQ]; + struct pnp_resource port[PNP_MAX_PORT]; + struct pnp_resource mem[PNP_MAX_MEM]; + struct pnp_resource dma[PNP_MAX_DMA]; + struct pnp_resource irq[PNP_MAX_IRQ]; }; diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 46a5e0e..4823da2 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c @@ -247,22 +247,22 @@ void pnp_init_resources(struct pnp_dev *dev) int idx; for (idx = 0; idx < PNP_MAX_IRQ; idx++) { - res = &dev->res->irq_resource[idx]; + res = &dev->res->irq[idx].res; res->flags = IORESOURCE_IRQ; pnp_init_resource(res); } for (idx = 0; idx < PNP_MAX_DMA; idx++) { - res = &dev->res->dma_resource[idx]; + res = &dev->res->dma[idx].res; res->flags = IORESOURCE_DMA; pnp_init_resource(res); } for (idx = 0; idx < PNP_MAX_PORT; idx++) { - res = &dev->res->port_resource[idx]; + res = &dev->res->port[idx].res; res->flags = IORESOURCE_IO; pnp_init_resource(res); } for (idx = 0; idx < PNP_MAX_MEM; idx++) { - res = &dev->res->mem_resource[idx]; + res = &dev->res->mem[idx].res; res->flags = IORESOURCE_MEM; pnp_init_resource(res); } @@ -278,28 +278,28 @@ static void pnp_clean_resource_table(struct pnp_dev *dev) int idx; for (idx = 0; idx < PNP_MAX_IRQ; idx++) { - res = &dev->res->irq_resource[idx]; + res = &dev->res->irq[idx].res; if (res->flags & IORESOURCE_AUTO) { res->flags = IORESOURCE_IRQ; pnp_init_resource(res); } } for (idx = 0; idx < PNP_MAX_DMA; idx++) { - res = &dev->res->dma_resource[idx]; + res = &dev->res->dma[idx].res; if (res->flags & IORESOURCE_AUTO) { res->flags = IORESOURCE_DMA; pnp_init_resource(res); } } for (idx = 0; idx < PNP_MAX_PORT; idx++) { - res = &dev->res->port_resource[idx]; + res = &dev->res->port[idx].res; if (res->flags & IORESOURCE_AUTO) { res->flags = IORESOURCE_IO; pnp_init_resource(res); } } for (idx = 0; idx < PNP_MAX_MEM; idx++) { - res = &dev->res->mem_resource[idx]; + res = &dev->res->mem[idx].res; if (res->flags & IORESOURCE_AUTO) { res->flags = IORESOURCE_MEM; pnp_init_resource(res); diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index f7adc7e..7e9f430 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c @@ -508,19 +508,19 @@ struct resource *pnp_get_resource(struct pnp_dev *dev, case IORESOURCE_IO: if (num >= PNP_MAX_PORT) return NULL; - return &res->port_resource[num]; + return &res->port[num].res; case IORESOURCE_MEM: if (num >= PNP_MAX_MEM) return NULL; - return &res->mem_resource[num]; + return &res->mem[num].res; case IORESOURCE_IRQ: if (num >= PNP_MAX_IRQ) return NULL; - return &res->irq_resource[num]; + return &res->irq[num].res; case IORESOURCE_DMA: if (num >= PNP_MAX_DMA) return NULL; - return &res->dma_resource[num]; + return &res->dma[num].res; } return NULL; } |