]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/pnp/resource.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[mirror_ubuntu-bionic-kernel.git] / drivers / pnp / resource.c
index 64d0596bafb5949aacc8e1ae9c6bffdd578f91fe..2e54e6a23c72c8ff44b610412e3c1c92baac81b8 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
@@ -470,7 +471,8 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
 unsigned long pnp_resource_type(struct resource *res)
 {
        return res->flags & (IORESOURCE_IO  | IORESOURCE_MEM |
-                            IORESOURCE_IRQ | IORESOURCE_DMA);
+                            IORESOURCE_IRQ | IORESOURCE_DMA |
+                            IORESOURCE_BUS);
 }
 
 struct resource *pnp_get_resource(struct pnp_dev *dev,
@@ -590,6 +592,30 @@ struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
        return pnp_res;
 }
 
+struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev,
+                                         resource_size_t start,
+                                         resource_size_t end)
+{
+       struct pnp_resource *pnp_res;
+       struct resource *res;
+
+       pnp_res = pnp_new_resource(dev);
+       if (!pnp_res) {
+               dev_err(&dev->dev, "can't add resource for BUS %#llx-%#llx\n",
+                       (unsigned long long) start,
+                       (unsigned long long) end);
+               return NULL;
+       }
+
+       res = &pnp_res->res;
+       res->flags = IORESOURCE_BUS;
+       res->start = start;
+       res->end = end;
+
+       pnp_dbg(&dev->dev, "  add %pr\n", res);
+       return pnp_res;
+}
+
 /*
  * Determine whether the specified resource is a possible configuration
  * for this device.