mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
KVM: x86: use list_for_each_entry*
Use list_for_each_entry*() instead of list_for_each*() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
e6e3b5a64e
commit
652fc08dae
@ -51,11 +51,9 @@ struct kvm_assigned_dev_kernel {
|
||||
static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(struct list_head *head,
|
||||
int assigned_dev_id)
|
||||
{
|
||||
struct list_head *ptr;
|
||||
struct kvm_assigned_dev_kernel *match;
|
||||
|
||||
list_for_each(ptr, head) {
|
||||
match = list_entry(ptr, struct kvm_assigned_dev_kernel, list);
|
||||
list_for_each_entry(match, head, list) {
|
||||
if (match->assigned_dev_id == assigned_dev_id)
|
||||
return match;
|
||||
}
|
||||
@ -373,14 +371,10 @@ static void kvm_free_assigned_device(struct kvm *kvm,
|
||||
|
||||
void kvm_free_all_assigned_devices(struct kvm *kvm)
|
||||
{
|
||||
struct list_head *ptr, *ptr2;
|
||||
struct kvm_assigned_dev_kernel *assigned_dev;
|
||||
|
||||
list_for_each_safe(ptr, ptr2, &kvm->arch.assigned_dev_head) {
|
||||
assigned_dev = list_entry(ptr,
|
||||
struct kvm_assigned_dev_kernel,
|
||||
list);
|
||||
struct kvm_assigned_dev_kernel *assigned_dev, *tmp;
|
||||
|
||||
list_for_each_entry_safe(assigned_dev, tmp,
|
||||
&kvm->arch.assigned_dev_head, list) {
|
||||
kvm_free_assigned_device(kvm, assigned_dev);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user