Skip to content

Commit

Permalink
mm/vmalloc.c: use list_{next,first}_entry
Browse files Browse the repository at this point in the history
To make the intention clearer, use list_{next,first}_entry instead of
list_entry.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Geliang Tang authored and Linus Torvalds committed Jan 15, 2016
1 parent 33d5310 commit 6219c2a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
if (list_is_last(&first->list, &vmap_area_list))
goto found;

first = list_entry(first->list.next,
struct vmap_area, list);
first = list_next_entry(first, list);
}

found:
Expand Down Expand Up @@ -2559,10 +2558,10 @@ static void *s_start(struct seq_file *m, loff_t *pos)
struct vmap_area *va;

spin_lock(&vmap_area_lock);
va = list_entry((&vmap_area_list)->next, typeof(*va), list);
va = list_first_entry(&vmap_area_list, typeof(*va), list);
while (n > 0 && &va->list != &vmap_area_list) {
n--;
va = list_entry(va->list.next, typeof(*va), list);
va = list_next_entry(va, list);
}
if (!n && &va->list != &vmap_area_list)
return va;
Expand All @@ -2576,7 +2575,7 @@ static void *s_next(struct seq_file *m, void *p, loff_t *pos)
struct vmap_area *va = p, *next;

++*pos;
next = list_entry(va->list.next, typeof(*va), list);
next = list_next_entry(va, list);
if (&next->list != &vmap_area_list)
return next;

Expand Down

0 comments on commit 6219c2a

Please sign in to comment.