diff options
author | Yi Liu <yi.l.liu@intel.com> | 2023-08-18 12:10:29 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2023-08-18 17:52:15 +0200 |
commit | 92766e1b953d6e419684b39f55dab574287dd144 (patch) | |
tree | 82d06dda3174ea44313462aa56a0f3f998e3c23d /drivers | |
parent | iommufd: Remove iommufd_ref_to_users() (diff) | |
download | linux-92766e1b953d6e419684b39f55dab574287dd144.tar.xz linux-92766e1b953d6e419684b39f55dab574287dd144.zip |
iommu: Move dev_iommu_ops() to private header
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/iommu/iommu-priv.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/iommu/iommu-priv.h b/drivers/iommu/iommu-priv.h index e3e3b2015854..2024a2313348 100644 --- a/drivers/iommu/iommu-priv.h +++ b/drivers/iommu/iommu-priv.h @@ -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); |