Commit 3a74ca01 authored by Yijing Wang's avatar Yijing Wang Committed by Joerg Roedel

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: default avatarYijing Wang <wangyijing@huawei.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 4c834452
...@@ -2102,13 +2102,11 @@ static inline void unlink_domain_info(struct device_domain_info *info) ...@@ -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) 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; unsigned long flags, flags2;
spin_lock_irqsave(&device_domain_lock, flags); spin_lock_irqsave(&device_domain_lock, flags);
while (!list_empty(&domain->devices)) { list_for_each_entry_safe(info, tmp, &domain->devices, link) {
info = list_entry(domain->devices.next,
struct device_domain_info, link);
unlink_domain_info(info); unlink_domain_info(info);
spin_unlock_irqrestore(&device_domain_lock, flags); spin_unlock_irqrestore(&device_domain_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment