linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / Hibernate: use rb_entry instead of container_of
@ 2016-12-19 15:03 Geliang Tang
  2016-12-19 20:08 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2016-12-19 15:03 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Len Brown
  Cc: Geliang Tang, linux-pm, linux-kernel

To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 kernel/power/swap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 32e0c23..f80fd33 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -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));
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM / Hibernate: use rb_entry instead of container_of
  2016-12-19 15:03 [PATCH] PM / Hibernate: use rb_entry instead of container_of Geliang Tang
@ 2016-12-19 20:08 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2016-12-19 20:08 UTC (permalink / raw)
  To: Geliang Tang; +Cc: Rafael J. Wysocki, Len Brown, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

On Mon 2016-12-19 23:03:11, Geliang Tang wrote:
> 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>

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-19 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 15:03 [PATCH] PM / Hibernate: use rb_entry instead of container_of Geliang Tang
2016-12-19 20:08 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).