Skip to content

Commit 94441c3

Browse files
committed
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 <[email protected]>
1 parent 85eebbc commit 94441c3

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

drivers/iommu/iommu.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@
2525
#include <linux/errno.h>
2626
#include <linux/iommu.h>
2727

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-
3828
static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops)
3929
{
4030
}
@@ -68,34 +58,25 @@ EXPORT_SYMBOL_GPL(bus_set_iommu);
6858

6959
bool iommu_present(struct bus_type *bus)
7060
{
71-
if (bus->iommu_ops != NULL)
72-
return true;
73-
else
74-
return iommu_ops != NULL;
61+
return bus->iommu_ops != NULL;
7562
}
7663
EXPORT_SYMBOL_GPL(iommu_present);
7764

7865
struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
7966
{
8067
struct iommu_domain *domain;
81-
struct iommu_ops *ops;
8268
int ret;
8369

84-
if (bus->iommu_ops)
85-
ops = bus->iommu_ops;
86-
else
87-
ops = iommu_ops;
88-
89-
if (ops == NULL)
70+
if (bus == NULL || bus->iommu_ops == NULL)
9071
return NULL;
9172

9273
domain = kmalloc(sizeof(*domain), GFP_KERNEL);
9374
if (!domain)
9475
return NULL;
9576

96-
domain->ops = ops;
77+
domain->ops = bus->iommu_ops;
9778

98-
ret = iommu_ops->domain_init(domain);
79+
ret = domain->ops->domain_init(domain);
9980
if (ret)
10081
goto out_free;
10182

include/linux/iommu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ struct iommu_ops {
5454
unsigned long cap);
5555
};
5656

57-
extern void register_iommu(struct iommu_ops *ops);
5857
extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
5958
extern bool iommu_present(struct bus_type *bus);
6059
extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);

0 commit comments

Comments
 (0)