Skip to content

Commit 92766e1

Browse files
yiliu1765jgunthorpe
authored andcommitted
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>
1 parent 65aaca1 commit 92766e1

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

drivers/iommu/iommu-priv.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66

77
#include <linux/iommu.h>
88

9+
static inline const struct iommu_ops *dev_iommu_ops(struct device *dev)
10+
{
11+
/*
12+
* Assume that valid ops must be installed if iommu_probe_device()
13+
* has succeeded. The device ops are essentially for internal use
14+
* within the IOMMU subsystem itself, so we should be able to trust
15+
* ourselves not to misuse the helper.
16+
*/
17+
return dev->iommu->iommu_dev->ops;
18+
}
19+
920
int iommu_group_replace_domain(struct iommu_group *group,
1021
struct iommu_domain *new_domain);
1122

include/linux/iommu.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -450,17 +450,6 @@ static inline void iommu_iotlb_gather_init(struct iommu_iotlb_gather *gather)
450450
};
451451
}
452452

453-
static inline const struct iommu_ops *dev_iommu_ops(struct device *dev)
454-
{
455-
/*
456-
* Assume that valid ops must be installed if iommu_probe_device()
457-
* has succeeded. The device ops are essentially for internal use
458-
* within the IOMMU subsystem itself, so we should be able to trust
459-
* ourselves not to misuse the helper.
460-
*/
461-
return dev->iommu->iommu_dev->ops;
462-
}
463-
464453
extern int bus_iommu_probe(const struct bus_type *bus);
465454
extern bool iommu_present(const struct bus_type *bus);
466455
extern bool device_iommu_capable(struct device *dev, enum iommu_cap cap);

0 commit comments

Comments
 (0)