[patch 30/53] PNP: convert resource initializers to use pnp_get_resource(), not pnp_resource_table

From: Bjorn Helgaas
Date: Fri Apr 18 2008 - 17:07:52 EST


This removes more direct references to pnp_resource_table.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>

Index: work8/drivers/pnp/manager.c
===================================================================
--- work8.orig/drivers/pnp/manager.c 2008-04-10 16:50:03.000000000 -0600
+++ work8/drivers/pnp/manager.c 2008-04-10 16:59:08.000000000 -0600
@@ -232,17 +232,17 @@
*/
void pnp_init_resources(struct pnp_dev *dev)
{
- struct pnp_resource_table *table = &dev->res;
- int idx;
+ struct resource *res;
+ int i;

- for (idx = 0; idx < PNP_MAX_IRQ; idx++)
- pnp_init_resource(&table->irq_resource[idx]);
- for (idx = 0; idx < PNP_MAX_DMA; idx++)
- pnp_init_resource(&table->dma_resource[idx]);
- for (idx = 0; idx < PNP_MAX_PORT; idx++)
- pnp_init_resource(&table->port_resource[idx]);
- for (idx = 0; idx < PNP_MAX_MEM; idx++)
- pnp_init_resource(&table->mem_resource[idx]);
+ for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IRQ, i)); i++)
+ pnp_init_resource(res);
+ for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_DMA, i)); i++)
+ pnp_init_resource(res);
+ for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IO, i)); i++)
+ pnp_init_resource(res);
+ for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++)
+ pnp_init_resource(res);
}

/**
@@ -251,24 +251,24 @@
*/
static void pnp_clean_resource_table(struct pnp_dev *dev)
{
- struct pnp_resource_table *table = &dev->res;
- int idx;
+ struct resource *res;
+ int i;

- for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
- if (table->irq_resource[idx].flags & IORESOURCE_AUTO)
- pnp_init_resource(&table->irq_resource[idx]);
- }
- for (idx = 0; idx < PNP_MAX_DMA; idx++) {
- if (table->dma_resource[idx].flags & IORESOURCE_AUTO)
- pnp_init_resource(&table->dma_resource[idx]);
- }
- for (idx = 0; idx < PNP_MAX_PORT; idx++) {
- if (table->port_resource[idx].flags & IORESOURCE_AUTO)
- pnp_init_resource(&table->port_resource[idx]);
- }
- for (idx = 0; idx < PNP_MAX_MEM; idx++) {
- if (table->mem_resource[idx].flags & IORESOURCE_AUTO)
- pnp_init_resource(&table->mem_resource[idx]);
+ for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IRQ, i)); i++) {
+ if (res->flags & IORESOURCE_AUTO)
+ pnp_init_resource(res);
+ }
+ for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_DMA, i)); i++) {
+ if (res->flags & IORESOURCE_AUTO)
+ pnp_init_resource(res);
+ }
+ for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_IO, i)); i++) {
+ if (res->flags & IORESOURCE_AUTO)
+ pnp_init_resource(res);
+ }
+ for (i = 0; (res = pnp_get_resource(dev, IORESOURCE_MEM, i)); i++) {
+ if (res->flags & IORESOURCE_AUTO)
+ pnp_init_resource(res);
}
}


--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/