]> err.no Git - linux-2.6/commitdiff
PNP: add pnp_get_pnp_resource()
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Mon, 28 Apr 2008 22:34:31 +0000 (16:34 -0600)
committerLen Brown <len.brown@intel.com>
Tue, 29 Apr 2008 07:22:28 +0000 (03:22 -0400)
In some places, we need to get the struct pnp_resource, not just
the struct resource, because ISAPNP needs to store the register
index in the pnp_resource.

I don't like pnp_get_pnp_resource() and hope that it is temporary,
but we need it for a little while.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/pnp/base.h
drivers/pnp/resource.c

index 1d6bb351d323a597209add80534730d668c55616..49b4138f3476561950470ecd9a6e0cbb3e40687e 100644 (file)
@@ -21,6 +21,9 @@ void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
 
 void pnp_init_resource(struct resource *res);
 
+struct pnp_resource *pnp_get_pnp_resource(struct pnp_dev *dev,
+                                         unsigned int type, unsigned int num);
+
 #define PNP_MAX_PORT           40
 #define PNP_MAX_MEM            24
 #define PNP_MAX_IRQ             2
index 7e9f4300e5f6eda0419ca24a2171750938b4a290..c57cfe51d52aab0da88270a93432c9fe0fbe5fa5 100644 (file)
@@ -499,8 +499,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
 #endif
 }
 
-struct resource *pnp_get_resource(struct pnp_dev *dev,
-                                 unsigned int type, unsigned int num)
+struct pnp_resource *pnp_get_pnp_resource(struct pnp_dev *dev,
+                                         unsigned int type, unsigned int num)
 {
        struct pnp_resource_table *res = dev->res;
 
@@ -508,22 +508,34 @@ struct resource *pnp_get_resource(struct pnp_dev *dev,
        case IORESOURCE_IO:
                if (num >= PNP_MAX_PORT)
                        return NULL;
-               return &res->port[num].res;
+               return &res->port[num];
        case IORESOURCE_MEM:
                if (num >= PNP_MAX_MEM)
                        return NULL;
-               return &res->mem[num].res;
+               return &res->mem[num];
        case IORESOURCE_IRQ:
                if (num >= PNP_MAX_IRQ)
                        return NULL;
-               return &res->irq[num].res;
+               return &res->irq[num];
        case IORESOURCE_DMA:
                if (num >= PNP_MAX_DMA)
                        return NULL;
-               return &res->dma[num].res;
+               return &res->dma[num];
        }
        return NULL;
 }
+
+struct resource *pnp_get_resource(struct pnp_dev *dev,
+                                 unsigned int type, unsigned int num)
+{
+       struct pnp_resource *pnp_res;
+
+       pnp_res = pnp_get_pnp_resource(dev, type, num);
+       if (pnp_res)
+               return &pnp_res->res;
+
+       return NULL;
+}
 EXPORT_SYMBOL(pnp_get_resource);
 
 /* format is: pnp_reserve_irq=irq1[,irq2] .... */