linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM/Hibernate: use rb_entry
@ 2012-03-18 23:54 Davidlohr Bueso
  2012-03-19 10:27 ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: Davidlohr Bueso @ 2012-03-18 23:54 UTC (permalink / raw)
  To: Pavel Machek, Rafael J. Wysocki; +Cc: lkml, linux-pm

From: Davidlohr Bueso <dave@gnu.org>

Since the software suspend extents are organized in an rbtree, use rb_entry
instead of container_of, as it is semantically more appropriate in order to
get a node as it is iterated.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 kernel/power/swap.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 8742fd0..1529b83 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -109,7 +109,7 @@ static int swsusp_extents_insert(unsigned long swap_offset)
 
 	/* Figure out where to put the new node */
 	while (*new) {
-		ext = container_of(*new, struct swsusp_extent, node);
+		ext = rb_entry(*new, struct swsusp_extent, node);
 		parent = *new;
 		if (swap_offset < ext->start) {
 			/* Try to merge */
@@ -175,7 +175,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));
-- 
1.7.4.1




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

* Re: [PATCH] PM/Hibernate: use rb_entry
  2012-03-18 23:54 [PATCH] PM/Hibernate: use rb_entry Davidlohr Bueso
@ 2012-03-19 10:27 ` Pavel Machek
  2012-05-27 14:07   ` Davidlohr Bueso
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2012-03-19 10:27 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: Rafael J. Wysocki, lkml, linux-pm

On Mon 2012-03-19 00:54:45, Davidlohr Bueso wrote:
> From: Davidlohr Bueso <dave@gnu.org>
> 
> Since the software suspend extents are organized in an rbtree, use rb_entry
> instead of container_of, as it is semantically more appropriate in order to
> get a node as it is iterated.
> 
> Signed-off-by: Davidlohr Bueso <dave@gnu.org>

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

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

* Re: [PATCH] PM/Hibernate: use rb_entry
  2012-03-19 10:27 ` Pavel Machek
@ 2012-05-27 14:07   ` Davidlohr Bueso
  0 siblings, 0 replies; 3+ messages in thread
From: Davidlohr Bueso @ 2012-05-27 14:07 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Rafael J. Wysocki, lkml, linux-pm

On Mon, 2012-03-19 at 11:27 +0100, Pavel Machek wrote:
> On Mon 2012-03-19 00:54:45, Davidlohr Bueso wrote:
> > From: Davidlohr Bueso <dave@gnu.org>
> > 
> > Since the software suspend extents are organized in an rbtree, use rb_entry
> > instead of container_of, as it is semantically more appropriate in order to
> > get a node as it is iterated.
> > 
> > Signed-off-by: Davidlohr Bueso <dave@gnu.org>
> 
> ACK.

ping about this...

thanks.


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

end of thread, other threads:[~2012-05-27 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-18 23:54 [PATCH] PM/Hibernate: use rb_entry Davidlohr Bueso
2012-03-19 10:27 ` Pavel Machek
2012-05-27 14:07   ` Davidlohr Bueso

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).