diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2011-09-06 12:58:54 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2011-10-21 08:37:23 -0400 |
commit | 94441c3bd99287b9d84f148a08cc9a44675ec749 (patch) | |
tree | edf4c7b2b9a78e30cb99f25cc5ac9ec0ec2f74bb /drivers/iommu/iommu.c | |
parent | 85eebbc5e4633e6eee10bdddd00d175daadd5841 (diff) |
iommu/core: Remove global iommu_ops and register_iommu
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>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r-- | drivers/iommu/iommu.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 1575aaa36c94..64419c88727e 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -25,16 +25,6 @@ | |||
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/iommu.h> | 26 | #include <linux/iommu.h> |
27 | 27 | ||
28 | static struct iommu_ops *iommu_ops; | ||
29 | |||
30 | void register_iommu(struct iommu_ops *ops) | ||
31 | { | ||
32 | if (iommu_ops) | ||
33 | BUG(); | ||
34 | |||
35 | iommu_ops = ops; | ||
36 | } | ||
37 | |||
38 | static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops) | 28 | static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops) |
39 | { | 29 | { |
40 | } | 30 | } |
@@ -68,34 +58,25 @@ EXPORT_SYMBOL_GPL(bus_set_iommu); | |||
68 | 58 | ||
69 | bool iommu_present(struct bus_type *bus) | 59 | bool iommu_present(struct bus_type *bus) |
70 | { | 60 | { |
71 | if (bus->iommu_ops != NULL) | 61 | return bus->iommu_ops != NULL; |
72 | return true; | ||
73 | else | ||
74 | return iommu_ops != NULL; | ||
75 | } | 62 | } |
76 | EXPORT_SYMBOL_GPL(iommu_present); | 63 | EXPORT_SYMBOL_GPL(iommu_present); |
77 | 64 | ||
78 | struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) | 65 | struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) |
79 | { | 66 | { |
80 | struct iommu_domain *domain; | 67 | struct iommu_domain *domain; |
81 | struct iommu_ops *ops; | ||
82 | int ret; | 68 | int ret; |
83 | 69 | ||
84 | if (bus->iommu_ops) | 70 | if (bus == NULL || bus->iommu_ops == NULL) |
85 | ops = bus->iommu_ops; | ||
86 | else | ||
87 | ops = iommu_ops; | ||
88 | |||
89 | if (ops == NULL) | ||
90 | return NULL; | 71 | return NULL; |
91 | 72 | ||
92 | domain = kmalloc(sizeof(*domain), GFP_KERNEL); | 73 | domain = kmalloc(sizeof(*domain), GFP_KERNEL); |
93 | if (!domain) | 74 | if (!domain) |
94 | return NULL; | 75 | return NULL; |
95 | 76 | ||
96 | domain->ops = ops; | 77 | domain->ops = bus->iommu_ops; |
97 | 78 | ||
98 | ret = iommu_ops->domain_init(domain); | 79 | ret = domain->ops->domain_init(domain); |
99 | if (ret) | 80 | if (ret) |
100 | goto out_free; | 81 | goto out_free; |
101 | 82 | ||