]> err.no Git - linux-2.6/blobdiff - drivers/pnp/resource.c
avr32/pata: avoid unnecessary memset (updated after comments)
[linux-2.6] / drivers / pnp / resource.c
index 64387b70026aadcc446d9344e16461362e880e0b..390b50096e30890f57d6cf6f55dc730d18013b47 100644 (file)
@@ -28,7 +28,7 @@ static int pnp_reserve_mem[16] = {[0 ... 15] = -1 };  /* reserve (don't use) some
  * option registration
  */
 
-static struct pnp_option *pnp_build_option(int priority)
+struct pnp_option *pnp_build_option(int priority)
 {
        struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option));
 
@@ -657,6 +657,35 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev,
        return pnp_res;
 }
 
+struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
+                                         resource_size_t start,
+                                         resource_size_t end, int flags)
+{
+       struct pnp_resource *pnp_res;
+       struct resource *res;
+       static unsigned char warned;
+
+       pnp_res = pnp_new_resource(dev, IORESOURCE_MEM);
+       if (!pnp_res) {
+               if (!warned) {
+                       dev_err(&dev->dev, "can't add resource for MEM "
+                               "%#llx-%#llx\n",(unsigned long long) start,
+                               (unsigned long long) end);
+                       warned = 1;
+               }
+               return NULL;
+       }
+
+       res = &pnp_res->res;
+       res->flags = IORESOURCE_MEM | flags;
+       res->start = start;
+       res->end = end;
+
+       dev_dbg(&dev->dev, "  add mem %#llx-%#llx flags %#x\n",
+               (unsigned long long) start, (unsigned long long) end, flags);
+       return pnp_res;
+}
+
 /* format is: pnp_reserve_irq=irq1[,irq2] .... */
 static int __init pnp_setup_reserve_irq(char *str)
 {