On Fri, Feb 23, 2007 at 12:49:01AM +0100, Rafael J. Wysocki wrote:
> Hi,
> 
> [Sorry for the delay.]
> 
> On Thursday, 22 February 2007 14:16, Stefan Seyfried wrote:
> > On Wed, Feb 21, 2007 at 07:49:54PM +0100, Rafael J. Wysocki wrote:
> > 
> > > Still, if you post it here again, I can have a look and make it nicer if 
> > > need be. ;-)
> > 
> > Indeed.
> > Maybe we should change the -ENODEV,
> 
> Yes, I think we should.

Ok, i read up the old thread and changed it to -ENOSYS ;-)

> > --- a/kernel/power/main.c   2007-02-01 01:07:38.000000000 +0100
> > +++ b/kernel/power/main.c   2007-02-01 22:24:41.000000000 +0100
> > @@ -116,7 +116,10 @@ int suspend_enter(suspend_state_t state)
> >             printk(KERN_ERR "Some devices failed to power down\n");
> >             goto Done;
> >     }
> > -   error = pm_ops->enter(state);
> > +   if (pm_ops && pm_ops->enter)
> > +           error = pm_ops->enter(state);
> > +   else
> > +           error = -ENODEV;
> >     device_power_up();
> >   Done:
> >     local_irq_restore(flags);
> 
> Well, I think the above chunk is not needed, because there is a check against
> !pm_ops in suspend_prepare().

Probably true, i think i just grepped for pm_ops-> through kernel/power/
back then :-)

New patch:

 user.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

--- a/kernel/power/user.c       2007-02-01 01:07:38.000000000 +0100
+++ b/kernel/power/user.c       2007-02-01 22:25:48.000000000 +0100
@@ -292,7 +292,7 @@ static int snapshot_ioctl(struct inode *
                        break;
                }
 
-               if (pm_ops->prepare) {
+               if (pm_ops && pm_ops->prepare) {
                        error = pm_ops->prepare(PM_SUSPEND_MEM);
                        if (error)
                                goto OutS3;
@@ -311,7 +311,7 @@ static int snapshot_ioctl(struct inode *
                        device_resume();
                }
                resume_console();
-               if (pm_ops->finish)
+               if (pm_ops && pm_ops->finish)
                        pm_ops->finish(PM_SUSPEND_MEM);
 
  OutS3:
@@ -322,20 +322,25 @@ static int snapshot_ioctl(struct inode *
                switch (arg) {
 
                case PMOPS_PREPARE:
-                       if (pm_ops->prepare) {
+                       if (pm_ops && pm_ops->prepare)
                                error = pm_ops->prepare(PM_SUSPEND_DISK);
-                       }
+                       else
+                               error = -ENOSYS;
                        break;
 
                case PMOPS_ENTER:
                        kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
-                       error = pm_ops->enter(PM_SUSPEND_DISK);
+                       if (pm_ops && pm_ops->enter)
+                               error = pm_ops->enter(PM_SUSPEND_DISK);
+                       else
+                               error = -ENOSYS;
                        break;
 
                case PMOPS_FINISH:
-                       if (pm_ops && pm_ops->finish) {
+                       if (pm_ops && pm_ops->finish)
                                pm_ops->finish(PM_SUSPEND_DISK);
-                       }
+                       else
+                               error = -ENOSYS;
                        break;
 
                default:
-- 
Stefan Seyfried

"Any ideas, John?"
"Well, surrounding them's out." 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to