From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH] PM: fix to earlier patch adding PM_RESTORE notifiers Date: Mon, 5 Nov 2007 22:07:05 +0100 Message-ID: <200711052207.06307.rjw@sisk.pl> References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org To: Alan Stern Cc: Linux-pm mailing list List-Id: linux-pm@vger.kernel.org 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 > > --- > > 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