Skip to contentSkip to conversation

xen: simplify balloon_first_page() with list_first_entry_or_null()

PATCH In review Jeff Liu 2 participants 2 messages Nov 13, 2013 Xen hypervisor interface

lore
Share & tools
lore

Jeff Liu

author
#0 lore raw

PATCH v2 1/1 xen: simplify balloon_first_page() with list_first_entry_or_null()

From: Jie Liu <[email protected]>

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.

---
v2: remove balloon_first_page() with this change.

 drivers/xen/balloon.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/xen/balloon.c +1 -8
index 55ea73f..16ffe91 100644
@@ -157,13 +157,6 @@ static struct page *balloon_retrieve(bool prefer_highmem)
 	return page;
 }
 
-static struct page *balloon_first_page(void)
-{
-	if (list_empty(&ballooned_pages))
-		return NULL;
-	return list_entry(ballooned_pages.next, struct page, lru);
-}
-
 static struct page *balloon_next_page(struct page *page)
 {
 	struct list_head *next = page->lru.next;
@@ -328,7 +321,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
 	if (nr_pages > ARRAY_SIZE(frame_list))
 		nr_pages = ARRAY_SIZE(frame_list);
 
-	page = balloon_first_page();
+	page = list_first_entry_or_null(&ballooned_pages, struct page, lru);
 	for (i = 0; i < nr_pages; i++) {
 		if (!page) {
 			nr_pages = i;
Signature · 1 line
1.8.3.2