Skip to content

Commit 41bb23e

Browse files
LuBaolujoergroedel
authored andcommitted
iommu: Remove unused argument in is_attach_deferred
The is_attach_deferred iommu_ops callback is a device op. The domain argument is unnecessary and never used. Remove it to make code clean. Suggested-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20220216025249.3459465-9-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 3f6634d commit 41bb23e

6 files changed

Lines changed: 11 additions & 17 deletions

File tree

drivers/iommu/amd/amd_iommu.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ void amd_iommu_domain_clr_pt_root(struct protection_domain *domain)
116116

117117

118118
extern bool translation_pre_enabled(struct amd_iommu *iommu);
119-
extern bool amd_iommu_is_attach_deferred(struct iommu_domain *domain,
120-
struct device *dev);
119+
extern bool amd_iommu_is_attach_deferred(struct device *dev);
121120
extern int __init add_special_device(u8 type, u8 id, u16 *devid,
122121
bool cmd_line);
123122

drivers/iommu/amd/iommu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,8 +2215,7 @@ static void amd_iommu_get_resv_regions(struct device *dev,
22152215
list_add_tail(&region->list, head);
22162216
}
22172217

2218-
bool amd_iommu_is_attach_deferred(struct iommu_domain *domain,
2219-
struct device *dev)
2218+
bool amd_iommu_is_attach_deferred(struct device *dev)
22202219
{
22212220
struct iommu_dev_data *dev_data = dev_iommu_priv_get(dev);
22222221

drivers/iommu/amd/iommu_v2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ static int ppr_notifier(struct notifier_block *nb, unsigned long e, void *data)
537537
ret = NOTIFY_DONE;
538538

539539
/* In kdump kernel pci dev is not initialized yet -> send INVALID */
540-
if (amd_iommu_is_attach_deferred(NULL, &pdev->dev)) {
540+
if (amd_iommu_is_attach_deferred(&pdev->dev)) {
541541
amd_iommu_complete_ppr(pdev, iommu_fault->pasid,
542542
PPR_INVALID, tag);
543543
goto out;

drivers/iommu/intel/iommu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5052,8 +5052,7 @@ intel_iommu_dev_disable_feat(struct device *dev, enum iommu_dev_features feat)
50525052
}
50535053
}
50545054

5055-
static bool intel_iommu_is_attach_deferred(struct iommu_domain *domain,
5056-
struct device *dev)
5055+
static bool intel_iommu_is_attach_deferred(struct device *dev)
50575056
{
50585057
return attach_deferred(dev);
50595058
}

drivers/iommu/iommu.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -831,13 +831,12 @@ static int iommu_create_device_direct_mappings(struct iommu_group *group,
831831
return ret;
832832
}
833833

834-
static bool iommu_is_attach_deferred(struct iommu_domain *domain,
835-
struct device *dev)
834+
static bool iommu_is_attach_deferred(struct device *dev)
836835
{
837836
const struct iommu_ops *ops = dev_iommu_ops(dev);
838837

839838
if (ops->is_attach_deferred)
840-
return ops->is_attach_deferred(domain, dev);
839+
return ops->is_attach_deferred(dev);
841840

842841
return false;
843842
}
@@ -894,7 +893,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)
894893

895894
mutex_lock(&group->mutex);
896895
list_add_tail(&device->list, &group->devices);
897-
if (group->domain && !iommu_is_attach_deferred(group->domain, dev))
896+
if (group->domain && !iommu_is_attach_deferred(dev))
898897
ret = __iommu_attach_device(group->domain, dev);
899898
mutex_unlock(&group->mutex);
900899
if (ret)
@@ -1745,7 +1744,7 @@ static int iommu_group_do_dma_attach(struct device *dev, void *data)
17451744
struct iommu_domain *domain = data;
17461745
int ret = 0;
17471746

1748-
if (!iommu_is_attach_deferred(domain, dev))
1747+
if (!iommu_is_attach_deferred(dev))
17491748
ret = __iommu_attach_device(domain, dev);
17501749

17511750
return ret;
@@ -2020,9 +2019,7 @@ EXPORT_SYMBOL_GPL(iommu_attach_device);
20202019

20212020
int iommu_deferred_attach(struct device *dev, struct iommu_domain *domain)
20222021
{
2023-
const struct iommu_ops *ops = dev_iommu_ops(dev);
2024-
2025-
if (ops->is_attach_deferred && ops->is_attach_deferred(domain, dev))
2022+
if (iommu_is_attach_deferred(dev))
20262023
return __iommu_attach_device(domain, dev);
20272024

20282025
return 0;
@@ -2031,7 +2028,7 @@ int iommu_deferred_attach(struct device *dev, struct iommu_domain *domain)
20312028
static void __iommu_detach_device(struct iommu_domain *domain,
20322029
struct device *dev)
20332030
{
2034-
if (iommu_is_attach_deferred(domain, dev))
2031+
if (iommu_is_attach_deferred(dev))
20352032
return;
20362033

20372034
if (unlikely(domain->ops->detach_dev == NULL))

include/linux/iommu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ struct iommu_ops {
269269
void (*put_resv_regions)(struct device *dev, struct list_head *list);
270270

271271
int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
272-
bool (*is_attach_deferred)(struct iommu_domain *domain, struct device *dev);
272+
bool (*is_attach_deferred)(struct device *dev);
273273

274274
/* Per device IOMMU features */
275275
bool (*dev_has_feat)(struct device *dev, enum iommu_dev_features f);

0 commit comments

Comments
 (0)