LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Device runtime suspend/resume fixes try #2
@ 2004-05-26 18:29 Todd Poynor
  2004-05-28 17:02 ` Greg KH
  2004-05-28 17:18 ` Patrick Mochel
  0 siblings, 2 replies; 4+ messages in thread
From: Todd Poynor @ 2004-05-26 18:29 UTC (permalink / raw)
  To: greg, mochel, linux-kernel, akpm

Andrew Morton wrote:

> err, this function needs a bit of work in the return value department...

Sorry, I'm a moron, try #2 below.

--- linux-2.6.6-orig/drivers/base/power/suspend.c	2004-05-10 11:22:58.000000000 -0700
+++ linux-2.6.6-pm/drivers/base/power/suspend.c	2004-05-23 00:07:51.000000000 -0700
@@ -42,13 +42,6 @@
 	if (dev->bus && dev->bus->suspend)
 		error = dev->bus->suspend(dev,state);
 
-	if (!error) {
-		list_del(&dev->power.entry);
-		list_add(&dev->power.entry,&dpm_off);
-	} else if (error == -EAGAIN) {
-		list_del(&dev->power.entry);
-		list_add(&dev->power.entry,&dpm_off_irq);
-	}
 	return error;
 }
 
@@ -81,12 +74,16 @@
 	while(!list_empty(&dpm_active)) {
 		struct list_head * entry = dpm_active.prev;
 		struct device * dev = to_device(entry);
-		if ((error = suspend_device(dev,state))) {
-			if (error != -EAGAIN)
-				goto Error;
-			else
-				error = 0;
-		}
+		error = suspend_device(dev,state);
+
+		if (!error) {
+			list_del(&dev->power.entry);
+			list_add(&dev->power.entry,&dpm_off);
+		} else if (error == -EAGAIN) {
+			list_del(&dev->power.entry);
+			list_add(&dev->power.entry,&dpm_off_irq);
+		} else
+			goto Error;
 	}
  Done:
 	up(&dpm_sem);
--- linux-2.6.6-orig/drivers/base/power/runtime.c	2004-05-10 11:22:58.000000000 -0700
+++ linux-2.6.6-pm/drivers/base/power/runtime.c	2004-05-26 10:37:05.193449240 -0700
@@ -14,7 +14,10 @@
 {
 	if (!dev->power.power_state)
 		return;
-	resume_device(dev);
+	if (! resume_device(dev))
+		dev->power.power_state = 0;
+
+	return;
 }
 

-- 
Todd

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

* Re: [PATCH] Device runtime suspend/resume fixes try #2
  2004-05-26 18:29 [PATCH] Device runtime suspend/resume fixes try #2 Todd Poynor
@ 2004-05-28 17:02 ` Greg KH
  2004-05-28 17:18 ` Patrick Mochel
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2004-05-28 17:02 UTC (permalink / raw)
  To: Todd Poynor; +Cc: mochel, linux-kernel, akpm

On Wed, May 26, 2004 at 11:29:55AM -0700, Todd Poynor wrote:
> Andrew Morton wrote:
> 
> > err, this function needs a bit of work in the return value department...
> 
> Sorry, I'm a moron, try #2 below.

Heh, that looks much better.

Applied, thanks.

greg k-h

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

* Re: [PATCH] Device runtime suspend/resume fixes try #2
  2004-05-26 18:29 [PATCH] Device runtime suspend/resume fixes try #2 Todd Poynor
  2004-05-28 17:02 ` Greg KH
@ 2004-05-28 17:18 ` Patrick Mochel
  2004-05-28 17:29   ` Greg KH
  1 sibling, 1 reply; 4+ messages in thread
From: Patrick Mochel @ 2004-05-28 17:18 UTC (permalink / raw)
  To: Todd Poynor; +Cc: greg, linux-kernel, akpm


> --- linux-2.6.6-orig/drivers/base/power/runtime.c	2004-05-10 11:22:58.000000000 -0700
> +++ linux-2.6.6-pm/drivers/base/power/runtime.c	2004-05-26 10:37:05.193449240 -0700
> @@ -14,7 +14,10 @@
>  {
>  	if (!dev->power.power_state)
>  		return;
> -	resume_device(dev);
> +	if (! resume_device(dev))
> +		dev->power.power_state = 0;
> +
> +	return;

You don't need to explicitly return from a void function. :)


	Pat

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

* Re: [PATCH] Device runtime suspend/resume fixes try #2
  2004-05-28 17:18 ` Patrick Mochel
@ 2004-05-28 17:29   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2004-05-28 17:29 UTC (permalink / raw)
  To: Patrick Mochel; +Cc: Todd Poynor, linux-kernel, akpm

On Fri, May 28, 2004 at 10:18:49AM -0700, Patrick Mochel wrote:
> 
> > --- linux-2.6.6-orig/drivers/base/power/runtime.c	2004-05-10 11:22:58.000000000 -0700
> > +++ linux-2.6.6-pm/drivers/base/power/runtime.c	2004-05-26 10:37:05.193449240 -0700
> > @@ -14,7 +14,10 @@
> >  {
> >  	if (!dev->power.power_state)
> >  		return;
> > -	resume_device(dev);
> > +	if (! resume_device(dev))
> > +		dev->power.power_state = 0;
> > +
> > +	return;
> 
> You don't need to explicitly return from a void function. :)

Oops, missed that.  I've fixed it up in my trees now.

thanks,

greg k-h

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

end of thread, other threads:[~2004-05-28 17:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-26 18:29 [PATCH] Device runtime suspend/resume fixes try #2 Todd Poynor
2004-05-28 17:02 ` Greg KH
2004-05-28 17:18 ` Patrick Mochel
2004-05-28 17:29   ` Greg KH

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