mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RESEND] PM/Hibernate: use rb_entry
@ 2012-10-01 10:12 Davidlohr Bueso
  2012-10-15  7:03 ` Rafael J. Wysocki
  2012-10-24 21:57 ` Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: Davidlohr Bueso @ 2012-10-01 10:12 UTC (permalink / raw)
  To: Pavel Machek, Rafael J. Wysocki, Len Brown; +Cc: linux-pm, lkml

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 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 3c9d764..7c33ed2 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -126,7 +126,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 */
-- 
1.7.9.5




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

* Re: [PATCH RESEND] PM/Hibernate: use rb_entry
  2012-10-01 10:12 [PATCH RESEND] PM/Hibernate: use rb_entry Davidlohr Bueso
@ 2012-10-15  7:03 ` Rafael J. Wysocki
  2012-10-24 21:57 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2012-10-15  7:03 UTC (permalink / raw)
  To: dave; +Cc: Pavel Machek, Len Brown, linux-pm, lkml

On Monday 01 of October 2012 12:12:52 Davidlohr Bueso wrote:
> 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>

I'll queue this up for v3.8 when I get back from the current trip.

Thanks,
Rafael


> ---
>  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 3c9d764..7c33ed2 100644
> --- a/kernel/power/swap.c
> +++ b/kernel/power/swap.c
> @@ -126,7 +126,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 */
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH RESEND] PM/Hibernate: use rb_entry
  2012-10-01 10:12 [PATCH RESEND] PM/Hibernate: use rb_entry Davidlohr Bueso
  2012-10-15  7:03 ` Rafael J. Wysocki
@ 2012-10-24 21:57 ` Rafael J. Wysocki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2012-10-24 21:57 UTC (permalink / raw)
  To: dave; +Cc: Pavel Machek, Len Brown, linux-pm, lkml

On Monday 01 of October 2012 12:12:52 Davidlohr Bueso wrote:
> 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>

Applied to linux-pm.git/linux-next as v3.8 material.

Thanks,
Rafael


> ---
>  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 3c9d764..7c33ed2 100644
> --- a/kernel/power/swap.c
> +++ b/kernel/power/swap.c
> @@ -126,7 +126,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 */
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2012-10-24 21:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-01 10:12 [PATCH RESEND] PM/Hibernate: use rb_entry Davidlohr Bueso
2012-10-15  7:03 ` Rafael J. Wysocki
2012-10-24 21:57 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®