Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1303442 > unrolled thread

Re: [PATCH 1/4] KVM: use list_for_each_entry_safe

Started byPaolo Bonzini <pbonzini@redhat.com>
First post2016-01-07 11:10 +0100
Last post2016-01-07 11:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/4] KVM: use list_for_each_entry_safe Paolo Bonzini <pbonzini@redhat.com> - 2016-01-07 11:10 +0100

#1303442 — Re: [PATCH 1/4] KVM: use list_for_each_entry_safe

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-01-07 11:10 +0100
SubjectRe: [PATCH 1/4] KVM: use list_for_each_entry_safe
Message-ID<qOfG2-6Gn-5@gated-at.bofh.it>

On 01/01/2016 12:47, Geliang Tang wrote:
> 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);
>  	}
>  }
> 

These patches will be considered for 4.6.  Thanks!

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web