diff options
author | Geliang Tang <geliangtang@163.com> | 2016-01-01 06:47:15 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-02-23 09:40:55 -0500 |
commit | 433da86023f866820e9bcd7f0889d944005d311c (patch) | |
tree | 96f31d4eeebf3bf37c6b3bda962975e865073abf | |
parent | d74c0e6b54c95ace01f05264a22aed99b565fabb (diff) |
KVM: async_pf: use list_first_entry
To make the intention clearer, use list_first_entry instead of
list_entry.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | virt/kvm/async_pf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c index 353159922456..c7e447c4296e 100644 --- a/virt/kvm/async_pf.c +++ b/virt/kvm/async_pf.c | |||
@@ -109,8 +109,8 @@ void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu) | |||
109 | /* cancel outstanding work queue item */ | 109 | /* cancel outstanding work queue item */ |
110 | while (!list_empty(&vcpu->async_pf.queue)) { | 110 | while (!list_empty(&vcpu->async_pf.queue)) { |
111 | struct kvm_async_pf *work = | 111 | struct kvm_async_pf *work = |
112 | list_entry(vcpu->async_pf.queue.next, | 112 | list_first_entry(&vcpu->async_pf.queue, |
113 | typeof(*work), queue); | 113 | typeof(*work), queue); |
114 | list_del(&work->queue); | 114 | list_del(&work->queue); |
115 | 115 | ||
116 | #ifdef CONFIG_KVM_ASYNC_PF_SYNC | 116 | #ifdef CONFIG_KVM_ASYNC_PF_SYNC |
@@ -127,8 +127,8 @@ void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu) | |||
127 | spin_lock(&vcpu->async_pf.lock); | 127 | spin_lock(&vcpu->async_pf.lock); |
128 | while (!list_empty(&vcpu->async_pf.done)) { | 128 | while (!list_empty(&vcpu->async_pf.done)) { |
129 | struct kvm_async_pf *work = | 129 | struct kvm_async_pf *work = |
130 | list_entry(vcpu->async_pf.done.next, | 130 | list_first_entry(&vcpu->async_pf.done, |
131 | typeof(*work), link); | 131 | typeof(*work), link); |
132 | list_del(&work->link); | 132 | list_del(&work->link); |
133 | kmem_cache_free(async_pf_cache, work); | 133 | kmem_cache_free(async_pf_cache, work); |
134 | } | 134 | } |