lkml.org 
[lkml]   [2008]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 30/53] PNP: convert resource initializers to use pnp_get_resource(), not pnp_resource_table
This removes more direct references to pnp_resource_table.

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

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);
}
}

--


\
 
 \ /
  Last update: 2008-04-18 23:11    [W:0.384 / U:0.316 seconds]
©2003-2014 Jasper Spaans. Advertise on this site