Linux IOMMU Development
 help / color / mirror / Atom feed
From: Yijing Wang <wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>,
	David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/6] iommu/vt-d: Use list_for_each_safe() to simplify code
Date: Tue, 20 May 2014 20:37:47 +0800	[thread overview]
Message-ID: <1400589472-8544-2-git-send-email-wangyijing@huawei.com> (raw)
In-Reply-To: <1400589472-8544-1-git-send-email-wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

Use list_for_each_entry_safe() instead of list_entry()
to simplify code.

Signed-off-by: Yijing Wang <wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 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 f256ffc..e020dcf 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2101,13 +2101,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);
 
-- 
1.7.1

  parent reply	other threads:[~2014-05-20 12:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 12:37 [PATCH 0/6] trivial cleanup for iommu/vt-d Yijing Wang
     [not found] ` <1400589472-8544-1-git-send-email-wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-05-20 12:37   ` Yijing Wang [this message]
2014-05-20 12:37   ` [PATCH 2/6] iommu/vt-d: move up no_iommu and dmar_disabled check Yijing Wang
     [not found]     ` <1400589472-8544-3-git-send-email-wangyijing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-07-04  9:06       ` Joerg Roedel
     [not found]         ` <20140704090640.GS26537-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-07-04  9:28           ` Yijing Wang
2014-05-20 12:37   ` [PATCH 3/6] iommu/vt-d: clear the redundant assignment in dmar_enable_qi Yijing Wang
2014-05-20 12:37   ` [PATCH 4/6] iommu/vt-d: clear the redundant assignment for domain->nid Yijing Wang
2014-05-20 12:37   ` [PATCH 5/6] iommu/vt-d: use inline function dma_pte_superpage instead of macros Yijing Wang
2014-05-20 12:37   ` [PATCH 6/6] iommu/vt-d: fix reference count in iommu_prepare_isa Yijing Wang
2014-06-18  0:56   ` [PATCH 0/6] trivial cleanup for iommu/vt-d Yijing Wang
2014-07-04  9:22   ` Joerg Roedel
     [not found]     ` <20140704092209.GA13434-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-07-04  9:29       ` Yijing Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400589472-8544-2-git-send-email-wangyijing@huawei.com \
    --to=wangyijing-hv44wf8li93qt0dzr+alfa@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox