diff options
author | Joerg Roedel <jroedel@suse.de> | 2015-03-26 08:43:19 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-03-31 09:32:16 -0400 |
commit | 89be34a1ced886880a3219f9d2ba2192dc738ef2 (patch) | |
tree | 32061686710be5bd6410ecf6bd1567b5960cd834 | |
parent | 8d4bfe40bd001c49caa9079541ff25522e7ed55d (diff) |
iommu: Remove domain_init and domain_free iommu_ops
All drivers have been converted to the new domain_alloc and
domain_free iommu-ops. So remove the old ones and get rid of
iommu_domain->priv too, as this is no longer needed when the
struct iommu_domain is embedded in the private structures of
the iommu drivers.
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/iommu.c | 30 | ||||
-rw-r--r-- | include/linux/iommu.h | 3 |
2 files changed, 2 insertions, 31 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 656b9499e748..d4f527e56679 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -900,51 +900,25 @@ EXPORT_SYMBOL_GPL(iommu_set_fault_handler); | |||
900 | 900 | ||
901 | struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) | 901 | struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) |
902 | { | 902 | { |
903 | const struct iommu_ops *ops; | ||
904 | struct iommu_domain *domain; | 903 | struct iommu_domain *domain; |
905 | 904 | ||
906 | if (bus == NULL || bus->iommu_ops == NULL) | 905 | if (bus == NULL || bus->iommu_ops == NULL) |
907 | return NULL; | 906 | return NULL; |
908 | 907 | ||
909 | ops = bus->iommu_ops; | 908 | domain = bus->iommu_ops->domain_alloc(IOMMU_DOMAIN_UNMANAGED); |
910 | |||
911 | if (ops->domain_alloc) | ||
912 | domain = ops->domain_alloc(IOMMU_DOMAIN_UNMANAGED); | ||
913 | else | ||
914 | domain = kzalloc(sizeof(*domain), GFP_KERNEL); | ||
915 | |||
916 | if (!domain) | 909 | if (!domain) |
917 | return NULL; | 910 | return NULL; |
918 | 911 | ||
919 | domain->ops = bus->iommu_ops; | 912 | domain->ops = bus->iommu_ops; |
920 | domain->type = IOMMU_DOMAIN_UNMANAGED; | 913 | domain->type = IOMMU_DOMAIN_UNMANAGED; |
921 | 914 | ||
922 | if (ops->domain_init && domain->ops->domain_init(domain)) | ||
923 | goto out_free; | ||
924 | |||
925 | return domain; | 915 | return domain; |
926 | |||
927 | out_free: | ||
928 | if (ops->domain_free) | ||
929 | ops->domain_free(domain); | ||
930 | else | ||
931 | kfree(domain); | ||
932 | |||
933 | return NULL; | ||
934 | } | 916 | } |
935 | EXPORT_SYMBOL_GPL(iommu_domain_alloc); | 917 | EXPORT_SYMBOL_GPL(iommu_domain_alloc); |
936 | 918 | ||
937 | void iommu_domain_free(struct iommu_domain *domain) | 919 | void iommu_domain_free(struct iommu_domain *domain) |
938 | { | 920 | { |
939 | const struct iommu_ops *ops = domain->ops; | 921 | domain->ops->domain_free(domain); |
940 | |||
941 | if (likely(ops->domain_destroy != NULL)) | ||
942 | ops->domain_destroy(domain); | ||
943 | |||
944 | if (ops->domain_free) | ||
945 | ops->domain_free(domain); | ||
946 | else | ||
947 | kfree(domain); | ||
948 | } | 922 | } |
949 | EXPORT_SYMBOL_GPL(iommu_domain_free); | 923 | EXPORT_SYMBOL_GPL(iommu_domain_free); |
950 | 924 | ||
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 72d03fe78cf6..0546b8710ce3 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -78,7 +78,6 @@ struct iommu_domain_geometry { | |||
78 | struct iommu_domain { | 78 | struct iommu_domain { |
79 | unsigned type; | 79 | unsigned type; |
80 | const struct iommu_ops *ops; | 80 | const struct iommu_ops *ops; |
81 | void *priv; | ||
82 | iommu_fault_handler_t handler; | 81 | iommu_fault_handler_t handler; |
83 | void *handler_token; | 82 | void *handler_token; |
84 | struct iommu_domain_geometry geometry; | 83 | struct iommu_domain_geometry geometry; |
@@ -138,8 +137,6 @@ enum iommu_attr { | |||
138 | */ | 137 | */ |
139 | struct iommu_ops { | 138 | struct iommu_ops { |
140 | bool (*capable)(enum iommu_cap); | 139 | bool (*capable)(enum iommu_cap); |
141 | int (*domain_init)(struct iommu_domain *domain); | ||
142 | void (*domain_destroy)(struct iommu_domain *domain); | ||
143 | 140 | ||
144 | /* Domain allocation and freeing by the iommu driver */ | 141 | /* Domain allocation and freeing by the iommu driver */ |
145 | struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type); | 142 | struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type); |