aboutsummaryrefslogtreecommitdiff
path: root/drivers/pnp/pnpbios/rsparser.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 16:34:29 -0600
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:27 -0400
commit06cb58a6eb0b689f95a6c055cfc400fd30c500c6 (patch)
treeb2b2cc2ac421091be7949315b6ffde6426466700 /drivers/pnp/pnpbios/rsparser.c
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/pnpbios/rsparser.c')
-rw-r--r--drivers/pnp/pnpbios/rsparser.c82
1 files changed, 46 insertions, 36 deletions
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index 9f0538af032..d3b0a4e5369 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -56,80 +56,90 @@ inline void pcibios_penalize_isa_irq(int irq, int active)
static void pnpbios_parse_allocated_irqresource(struct pnp_dev *dev, int irq)
{
- struct pnp_resource_table *res = dev->res;
- int i = 0;
+ struct resource *res;
+ int i;
+
+ for (i = 0; i < PNP_MAX_IRQ; i++) {
+ res = pnp_get_resource(dev, IORESOURCE_IRQ, i);
+ if (!pnp_resource_valid(res))
+ break;
+ }
- while (!(res->irq_resource[i].flags & IORESOURCE_UNSET)
- && i < PNP_MAX_IRQ)
- i++;
if (i < PNP_MAX_IRQ) {
- res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
+ res->flags = IORESOURCE_IRQ; // Also clears _UNSET flag
if (irq == -1) {
- res->irq_resource[i].flags |= IORESOURCE_DISABLED;
+ res->flags |= IORESOURCE_DISABLED;
return;
}
- res->irq_resource[i].start =
- res->irq_resource[i].end = (unsigned long)irq;
+ res->start = res->end = (unsigned long)irq;
pcibios_penalize_isa_irq(irq, 1);
}
}
static void pnpbios_parse_allocated_dmaresource(struct pnp_dev *dev, int dma)
{
- struct pnp_resource_table *res = dev->res;
- int i = 0;
+ struct resource *res;
+ int i;
+
+ for (i = 0; i < PNP_MAX_DMA; i++) {
+ res = pnp_get_resource(dev, IORESOURCE_DMA, i);
+ if (!pnp_resource_valid(res))
+ break;
+ }
- while (i < PNP_MAX_DMA &&
- !(res->dma_resource[i].flags & IORESOURCE_UNSET))
- i++;
if (i < PNP_MAX_DMA) {
- res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag
+ res->flags = IORESOURCE_DMA; // Also clears _UNSET flag
if (dma == -1) {
- res->dma_resource[i].flags |= IORESOURCE_DISABLED;
+ res->flags |= IORESOURCE_DISABLED;
return;
}
- res->dma_resource[i].start =
- res->dma_resource[i].end = (unsigned long)dma;
+ res->start = res->end = (unsigned long)dma;
}
}
static void pnpbios_parse_allocated_ioresource(struct pnp_dev *dev,
int io, int len)
{
- struct pnp_resource_table *res = dev->res;
- int i = 0;
+ struct resource *res;
+ int i;
+
+ for (i = 0; i < PNP_MAX_PORT; i++) {
+ res = pnp_get_resource(dev, IORESOURCE_IO, i);
+ if (!pnp_resource_valid(res))
+ break;
+ }
- while (!(res->port_resource[i].flags & IORESOURCE_UNSET)
- && i < PNP_MAX_PORT)
- i++;
if (i < PNP_MAX_PORT) {
- res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag
+ res->flags = IORESOURCE_IO; // Also clears _UNSET flag
if (len <= 0 || (io + len - 1) >= 0x10003) {
- res->port_resource[i].flags |= IORESOURCE_DISABLED;
+ res->flags |= IORESOURCE_DISABLED;
return;
}
- res->port_resource[i].start = (unsigned long)io;
- res->port_resource[i].end = (unsigned long)(io + len - 1);
+ res->start = (unsigned long)io;
+ res->end = (unsigned long)(io + len - 1);
}
}
static void pnpbios_parse_allocated_memresource(struct pnp_dev *dev,
int mem, int len)
{
- struct pnp_resource_table *res = dev->res;
- int i = 0;
+ struct resource *res;
+ int i;
+
+ for (i = 0; i < PNP_MAX_MEM; i++) {
+ res = pnp_get_resource(dev, IORESOURCE_MEM, i);
+ if (!pnp_resource_valid(res))
+ break;
+ }
- while (!(res->mem_resource[i].flags & IORESOURCE_UNSET)
- && i < PNP_MAX_MEM)
- i++;
if (i < PNP_MAX_MEM) {
- res->mem_resource[i].flags = IORESOURCE_MEM; // Also clears _UNSET flag
+ res->flags = IORESOURCE_MEM; // Also clears _UNSET flag
if (len <= 0) {
- res->mem_resource[i].flags |= IORESOURCE_DISABLED;
+ res->flags |= IORESOURCE_DISABLED;
return;
}
- res->mem_resource[i].start = (unsigned long)mem;
- res->mem_resource[i].end = (unsigned long)(mem + len - 1);
+ res->start = (unsigned long)mem;
+ res->end = (unsigned long)(mem + len - 1);
}
}