Re: [PATCH v1 1/3] iommu/vt-d: Eliminate pci_physfn() in dmar_find_matched_satc_unit()

From: Yi Liu
Date: Fri May 09 2025 - 05:09:53 EST


On 2025/5/9 22:00, Wei Wang wrote:
The function dmar_find_matched_satc_unit() contains a duplicate call to
pci_physfn(). This call is unnecessary as pci_physfn() has already been
invoked by the caller. Removing the redundant call simplifies the code
and improves efficiency a bit.

Signed-off-by: Wei Wang <wei.w.wang@xxxxxxxxx>
---
drivers/iommu/intel/iommu.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index cb0b993bebb4..d8aa71305509 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2744,7 +2744,6 @@ static struct dmar_satc_unit *dmar_find_matched_satc_unit(struct pci_dev *dev)
struct device *tmp;
int i;
- dev = pci_physfn(dev);

better have a comment to highlight the input dev should be PF. also, can
add a WARN_ON(dev->is_virtfn);

rcu_read_lock();
list_for_each_entry_rcu(satcu, &dmar_satc_units, list) {

--
Regards,
Yi Liu