iommu/vt-d: Use list_for_each_entry_safe() for dmar_domain->devices traversal
Replace list_for_each_safe() + list_entry() with the simpler list_for_each_entry_safe(). Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Joerg Roedel <joro@8bytes.org>
This commit is contained in:
committed by
Joerg Roedel
parent
8b161f0ee9
commit
bca2b916f3
@@ -3781,11 +3781,10 @@ static void iommu_detach_dependent_devices(struct intel_iommu *iommu,
|
|||||||
static void domain_remove_one_dev_info(struct dmar_domain *domain,
|
static void domain_remove_one_dev_info(struct dmar_domain *domain,
|
||||||
struct pci_dev *pdev)
|
struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
struct device_domain_info *info;
|
struct device_domain_info *info, *tmp;
|
||||||
struct intel_iommu *iommu;
|
struct intel_iommu *iommu;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
struct list_head *entry, *tmp;
|
|
||||||
|
|
||||||
iommu = device_to_iommu(pci_domain_nr(pdev->bus), pdev->bus->number,
|
iommu = device_to_iommu(pci_domain_nr(pdev->bus), pdev->bus->number,
|
||||||
pdev->devfn);
|
pdev->devfn);
|
||||||
@@ -3793,8 +3792,7 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock_irqsave(&device_domain_lock, flags);
|
spin_lock_irqsave(&device_domain_lock, flags);
|
||||||
list_for_each_safe(entry, tmp, &domain->devices) {
|
list_for_each_entry_safe(info, tmp, &domain->devices, link) {
|
||||||
info = list_entry(entry, struct device_domain_info, link);
|
|
||||||
if (info->segment == pci_domain_nr(pdev->bus) &&
|
if (info->segment == pci_domain_nr(pdev->bus) &&
|
||||||
info->bus == pdev->bus->number &&
|
info->bus == pdev->bus->number &&
|
||||||
info->devfn == pdev->devfn) {
|
info->devfn == pdev->devfn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user