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.
> if we have different return codes in 2.6.21+, but otherwise it is pretty
> trivial:
>
> main.c | 5 ++++-
> user.c | 19 ++++++++++++-------
> 2 files changed, 16 insertions(+), 8 deletions(-)
>
> --- 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().
> --- 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 = -ENODEV;
> 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 = -ENODEV;
> break;
>
> case PMOPS_FINISH:
> - if (pm_ops && pm_ops->finish) {
> + if (pm_ops && pm_ops->finish)
> pm_ops->finish(PM_SUSPEND_DISK);
> - }
> + else
> + error = -ENODEV;
> break;
>
> default:
--
If you don't have the time to read,
you don't have the time or the tools to write.
- Stephen King
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/suspend-devel