]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pnp/core.c
ide: add request_sense_{pc,rq} to ide_drive_t
[linux-2.6-omap-h63xx.git] / drivers / pnp / core.c
index cf37701a4f9ee4f2f7e6aef734f37ecc13d4292b..a411582bcd72d3caf7638fc1ede2a0747498af6e 100644 (file)
@@ -99,13 +99,28 @@ static void pnp_free_ids(struct pnp_dev *dev)
        }
 }
 
+void pnp_free_resource(struct pnp_resource *pnp_res)
+{
+       list_del(&pnp_res->list);
+       kfree(pnp_res);
+}
+
+void pnp_free_resources(struct pnp_dev *dev)
+{
+       struct pnp_resource *pnp_res, *tmp;
+
+       list_for_each_entry_safe(pnp_res, tmp, &dev->resources, list) {
+               pnp_free_resource(pnp_res);
+       }
+}
+
 static void pnp_release_device(struct device *dmdev)
 {
        struct pnp_dev *dev = to_pnp_dev(dmdev);
 
-       pnp_free_option(dev->independent);
-       pnp_free_option(dev->dependent);
        pnp_free_ids(dev);
+       pnp_free_resources(dev);
+       pnp_free_options(dev);
        kfree(dev);
 }
 
@@ -118,6 +133,8 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid
        if (!dev)
                return NULL;
 
+       INIT_LIST_HEAD(&dev->resources);
+       INIT_LIST_HEAD(&dev->options);
        dev->protocol = protocol;
        dev->number = id;
        dev->dma_mask = DMA_24BIT_MASK;