diff options
author | Yijing Wang <wangyijing@huawei.com> | 2014-05-20 08:37:47 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2014-07-04 05:16:20 -0400 |
commit | 3a74ca0140f64ae3c61c2f6230bc0c07efc0343b (patch) | |
tree | 6e1e898a2d4db3953613f6fe1a7c20c40599b63b /drivers/iommu/intel-iommu.c | |
parent | 4c834452aad01531db949414f94f817a86348d59 (diff) |
iommu/vt-d: Use list_for_each_safe() to simplify code
Use list_for_each_entry_safe() instead of list_entry()
to simplify code.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r-- | drivers/iommu/intel-iommu.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 51b6b77dc3e5..4b0f1ac30478 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -2102,13 +2102,11 @@ static inline void unlink_domain_info(struct device_domain_info *info) | |||
2102 | 2102 | ||
2103 | static void domain_remove_dev_info(struct dmar_domain *domain) | 2103 | static void domain_remove_dev_info(struct dmar_domain *domain) |
2104 | { | 2104 | { |
2105 | struct device_domain_info *info; | 2105 | struct device_domain_info *info, *tmp; |
2106 | unsigned long flags, flags2; | 2106 | unsigned long flags, flags2; |
2107 | 2107 | ||
2108 | spin_lock_irqsave(&device_domain_lock, flags); | 2108 | spin_lock_irqsave(&device_domain_lock, flags); |
2109 | while (!list_empty(&domain->devices)) { | 2109 | list_for_each_entry_safe(info, tmp, &domain->devices, link) { |
2110 | info = list_entry(domain->devices.next, | ||
2111 | struct device_domain_info, link); | ||
2112 | unlink_domain_info(info); | 2110 | unlink_domain_info(info); |
2113 | spin_unlock_irqrestore(&device_domain_lock, flags); | 2111 | spin_unlock_irqrestore(&device_domain_lock, flags); |
2114 | 2112 | ||