public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: fix to earlier patch adding PM_RESTORE notifiers
@ 2007-11-05 20:39 Alan Stern
  2007-11-05 21:07 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Stern @ 2007-11-05 20:39 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux-pm mailing list

This patch (as1007) fixes a mistake in the patch adding the PM RESTORE
notifiers.  The PM_POST_RESTORE notifier should be called if an error
occurs in the PM_RESTORE_PREPARE notifications.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

---

Rafael:

Len may prefer to merge this with the earlier patch rather than keeping
the two separate.  It's a very small update.

Alan Stern


Index: usb-2.6/kernel/power/disk.c
===================================================================
--- usb-2.6.orig/kernel/power/disk.c
+++ usb-2.6/kernel/power/disk.c
@@ -491,7 +491,7 @@ static int software_resume(void)
 
 	error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
 	if (error)
-		goto Exit;
+		goto Finish;
 
 	error = create_basic_memory_bitmaps();
 	if (error)
@@ -517,7 +517,6 @@ static int software_resume(void)
 	free_basic_memory_bitmaps();
  Finish:
 	pm_notifier_call_chain(PM_POST_RESTORE);
- Exit:
 	atomic_inc(&snapshot_device_available);
 	/* For success case, the suspend path will release the lock */
  Unlock:
Index: usb-2.6/kernel/power/user.c
===================================================================
--- usb-2.6.orig/kernel/power/user.c
+++ usb-2.6/kernel/power/user.c
@@ -66,10 +66,14 @@ static int snapshot_open(struct inode *i
 			swap_type_of(swsusp_resume_device, 0, NULL) : -1;
 		data->mode = O_RDONLY;
 		error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
+		if (error)
+			pm_notifier_call_chain(PM_POST_RESTORE);
 	} else {
 		data->swap = -1;
 		data->mode = O_WRONLY;
 		error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
+		if (error)
+			pm_notifier_call_chain(PM_POST_HIBERNATION);
 	}
 	if (error) {
 		atomic_inc(&snapshot_device_available);

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

* Re: [PATCH] PM: fix to earlier patch adding PM_RESTORE notifiers
  2007-11-05 20:39 [PATCH] PM: fix to earlier patch adding PM_RESTORE notifiers Alan Stern
@ 2007-11-05 21:07 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2007-11-05 21:07 UTC (permalink / raw)
  To: Alan Stern; +Cc: Linux-pm mailing list

On Monday, 5 of November 2007, Alan Stern wrote:
> This patch (as1007) fixes a mistake in the patch adding the PM RESTORE
> notifiers.  The PM_POST_RESTORE notifier should be called if an error
> occurs in the PM_RESTORE_PREPARE notifications.

Ah, I see.

> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> 
> ---
> 
> Rafael:
> 
> Len may prefer to merge this with the earlier patch rather than keeping
> the two separate.  It's a very small update.

Yes.  I think I'll merge the two and send the result as the next revision of
the previous patch.

Greetings,
Rafael


> Index: usb-2.6/kernel/power/disk.c
> ===================================================================
> --- usb-2.6.orig/kernel/power/disk.c
> +++ usb-2.6/kernel/power/disk.c
> @@ -491,7 +491,7 @@ static int software_resume(void)
>  
>  	error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
>  	if (error)
> -		goto Exit;
> +		goto Finish;
>  
>  	error = create_basic_memory_bitmaps();
>  	if (error)
> @@ -517,7 +517,6 @@ static int software_resume(void)
>  	free_basic_memory_bitmaps();
>   Finish:
>  	pm_notifier_call_chain(PM_POST_RESTORE);
> - Exit:
>  	atomic_inc(&snapshot_device_available);
>  	/* For success case, the suspend path will release the lock */
>   Unlock:
> Index: usb-2.6/kernel/power/user.c
> ===================================================================
> --- usb-2.6.orig/kernel/power/user.c
> +++ usb-2.6/kernel/power/user.c
> @@ -66,10 +66,14 @@ static int snapshot_open(struct inode *i
>  			swap_type_of(swsusp_resume_device, 0, NULL) : -1;
>  		data->mode = O_RDONLY;
>  		error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
> +		if (error)
> +			pm_notifier_call_chain(PM_POST_RESTORE);
>  	} else {
>  		data->swap = -1;
>  		data->mode = O_WRONLY;
>  		error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
> +		if (error)
> +			pm_notifier_call_chain(PM_POST_HIBERNATION);
>  	}
>  	if (error) {
>  		atomic_inc(&snapshot_device_available);
> 
> 
> 



-- 
"Premature optimization is the root of all evil." - Donald Knuth

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

end of thread, other threads:[~2007-11-05 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-05 20:39 [PATCH] PM: fix to earlier patch adding PM_RESTORE notifiers Alan Stern
2007-11-05 21:07 ` 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