iommu/core: Remove global iommu_ops and register_iommu
authorJoerg Roedel <joerg.roedel@amd.com>
Tue, 6 Sep 2011 16:58:54 +0000 (18:58 +0200)
committerJoerg Roedel <joerg.roedel@amd.com>
Fri, 21 Oct 2011 12:37:23 +0000 (14:37 +0200)
With all IOMMU drivers being converted to bus_set_iommu the
global iommu_ops are no longer required. The same is true
for the deprecated register_iommu function.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/iommu.c
include/linux/iommu.h

index 1575aaa36c94d9c16b6d8d77c2e59e96e50324cf..64419c88727e1a57351aa4d323ef56649d7e1954 100644 (file)
 #include <linux/errno.h>
 #include <linux/iommu.h>
 
-static struct iommu_ops *iommu_ops;
-
-void register_iommu(struct iommu_ops *ops)
-{
-       if (iommu_ops)
-               BUG();
-
-       iommu_ops = ops;
-}
-
 static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops)
 {
 }
@@ -68,34 +58,25 @@ EXPORT_SYMBOL_GPL(bus_set_iommu);
 
 bool iommu_present(struct bus_type *bus)
 {
-       if (bus->iommu_ops != NULL)
-               return true;
-       else
-               return iommu_ops != NULL;
+       return bus->iommu_ops != NULL;
 }
 EXPORT_SYMBOL_GPL(iommu_present);
 
 struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
 {
        struct iommu_domain *domain;
-       struct iommu_ops *ops;
        int ret;
 
-       if (bus->iommu_ops)
-               ops = bus->iommu_ops;
-       else
-               ops = iommu_ops;
-
-       if (ops == NULL)
+       if (bus == NULL || bus->iommu_ops == NULL)
                return NULL;
 
        domain = kmalloc(sizeof(*domain), GFP_KERNEL);
        if (!domain)
                return NULL;
 
-       domain->ops = ops;
+       domain->ops = bus->iommu_ops;
 
-       ret = iommu_ops->domain_init(domain);
+       ret = domain->ops->domain_init(domain);
        if (ret)
                goto out_free;
 
index f56e559442a2dad5975b73b4b8c703c634cf7e4d..609ebf6bbe0c15cd0f1ecf8801c14c521fdf993d 100644 (file)
@@ -54,7 +54,6 @@ struct iommu_ops {
                              unsigned long cap);
 };
 
-extern void register_iommu(struct iommu_ops *ops);
 extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
 extern bool iommu_present(struct bus_type *bus);
 extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);