Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xen: simplify balloon_first_page() with list_first_entry_or_null()

Replace the code logic at balloon_first_page() by calling
list_first_entry_or_null() directly. since here is only
one user of that routine, therefore we can just remove it.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>

authored by

Jie Liu and committed by
Konrad Rzeszutek Wilk
9346c2a8 02bcf053

+1 -8
+1 -8
drivers/xen/balloon.c
··· 157 157 return page; 158 158 } 159 159 160 - static struct page *balloon_first_page(void) 161 - { 162 - if (list_empty(&ballooned_pages)) 163 - return NULL; 164 - return list_entry(ballooned_pages.next, struct page, lru); 165 - } 166 - 167 160 static struct page *balloon_next_page(struct page *page) 168 161 { 169 162 struct list_head *next = page->lru.next; ··· 321 328 if (nr_pages > ARRAY_SIZE(frame_list)) 322 329 nr_pages = ARRAY_SIZE(frame_list); 323 330 324 - page = balloon_first_page(); 331 + page = list_first_entry_or_null(&ballooned_pages, struct page, lru); 325 332 for (i = 0; i < nr_pages; i++) { 326 333 if (!page) { 327 334 nr_pages = i;