All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] KVM: use list_for_each_entry_safe
@ 2016-01-01 11:47 Geliang Tang
  2016-01-01 11:47 ` [PATCH 2/4] KVM: x86: use list_for_each_entry* Geliang Tang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Geliang Tang @ 2016-01-01 11:47 UTC (permalink / raw)
  To: Gleb Natapov, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin
  Cc: Geliang Tang, x86, kvm, linux-kernel

Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 virt/kvm/kvm_main.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 484079e..5b6df4f 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -630,13 +630,10 @@ void *kvm_kvzalloc(unsigned long size)
 
 static void kvm_destroy_devices(struct kvm *kvm)
 {
-	struct list_head *node, *tmp;
+	struct kvm_device *dev, *tmp;
 
-	list_for_each_safe(node, tmp, &kvm->devices) {
-		struct kvm_device *dev =
-			list_entry(node, struct kvm_device, vm_node);
-
-		list_del(node);
+	list_for_each_entry_safe(dev, tmp, &kvm->devices, vm_node) {
+		list_del(&dev->vm_node);
 		dev->ops->destroy(dev);
 	}
 }
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-07 10:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-01 11:47 [PATCH 1/4] KVM: use list_for_each_entry_safe Geliang Tang
2016-01-01 11:47 ` [PATCH 2/4] KVM: x86: use list_for_each_entry* Geliang Tang
2016-01-01 11:47 ` [PATCH 3/4] KVM: x86: use list_last_entry Geliang Tang
2016-01-01 11:47 ` [PATCH 4/4] KVM: async_pf: use list_first_entry Geliang Tang
2016-01-07 10:07 ` [PATCH 1/4] KVM: use list_for_each_entry_safe Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.