summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/intel-iommu.c
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2014-05-20 14:37:47 +0200
committerJoerg Roedel <jroedel@suse.de>2014-07-04 11:16:20 +0200
commit3a74ca0140f64ae3c61c2f6230bc0c07efc0343b (patch)
tree6e1e898a2d4db3953613f6fe1a7c20c40599b63b /drivers/iommu/intel-iommu.c
parentLinux 3.16-rc3 (diff)
downloadlinux-3a74ca0140f64ae3c61c2f6230bc0c07efc0343b.tar.xz
linux-3a74ca0140f64ae3c61c2f6230bc0c07efc0343b.zip
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.c6
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)
static void domain_remove_dev_info(struct dmar_domain *domain)
{
- struct device_domain_info *info;
+ struct device_domain_info *info, *tmp;
unsigned long flags, flags2;
spin_lock_irqsave(&device_domain_lock, flags);
- while (!list_empty(&domain->devices)) {
- info = list_entry(domain->devices.next,
- struct device_domain_info, link);
+ list_for_each_entry_safe(info, tmp, &domain->devices, link) {
unlink_domain_info(info);
spin_unlock_irqrestore(&device_domain_lock, flags);