iommu: Move dev_iommu_ops() to private header
authorYi Liu <yi.l.liu@intel.com>
Fri, 18 Aug 2023 10:10:29 +0000 (03:10 -0700)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 18 Aug 2023 15:52:15 +0000 (12:52 -0300)
dev_iommu_ops() is essentially only used in iommu subsystem, so move to a
private header to avoid being abused by other drivers.

Link: https://lore.kernel.org/r/20230818101033.4100-2-yi.l.liu@intel.com
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommu-priv.h
include/linux/iommu.h

index e3e3b2015854a66c7d25efe58d417a3f9bf360f5..2024a2313348686f071a8331f7d922f03907c76f 100644 (file)
@@ -6,6 +6,17 @@
 
 #include <linux/iommu.h>
 
+static inline const struct iommu_ops *dev_iommu_ops(struct device *dev)
+{
+       /*
+        * Assume that valid ops must be installed if iommu_probe_device()
+        * has succeeded. The device ops are essentially for internal use
+        * within the IOMMU subsystem itself, so we should be able to trust
+        * ourselves not to misuse the helper.
+        */
+       return dev->iommu->iommu_dev->ops;
+}
+
 int iommu_group_replace_domain(struct iommu_group *group,
                               struct iommu_domain *new_domain);
 
index d3164259667599679673cf45226f82b25b4018ad..e0245aa82b7561fdb5518f7cb2abce77477a5057 100644 (file)
@@ -450,17 +450,6 @@ static inline void iommu_iotlb_gather_init(struct iommu_iotlb_gather *gather)
        };
 }
 
-static inline const struct iommu_ops *dev_iommu_ops(struct device *dev)
-{
-       /*
-        * Assume that valid ops must be installed if iommu_probe_device()
-        * has succeeded. The device ops are essentially for internal use
-        * within the IOMMU subsystem itself, so we should be able to trust
-        * ourselves not to misuse the helper.
-        */
-       return dev->iommu->iommu_dev->ops;
-}
-
 extern int bus_iommu_probe(const struct bus_type *bus);
 extern bool iommu_present(const struct bus_type *bus);
 extern bool device_iommu_capable(struct device *dev, enum iommu_cap cap);