PM / Hibernate: Use rb_entry() instead of container_of()
authorGeliang Tang <geliangtang@gmail.com>
Mon, 19 Dec 2016 15:03:11 +0000 (23:03 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 27 Jan 2017 10:31:12 +0000 (11:31 +0100)
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/swap.c

index 32e0c232efbafa4a3c8f6f40468c61eaad937d5b..f80fd33639e0e5f5b4fc7b1fb53ecfd87b1eaa4d 100644 (file)
@@ -201,7 +201,7 @@ void free_all_swap_pages(int swap)
                struct swsusp_extent *ext;
                unsigned long offset;
 
-               ext = container_of(node, struct swsusp_extent, node);
+               ext = rb_entry(node, struct swsusp_extent, node);
                rb_erase(node, &swsusp_extents);
                for (offset = ext->start; offset <= ext->end; offset++)
                        swap_free(swp_entry(swap, offset));