Re: [pm] Some typos

From: Pavel Machek
Date: Wed Oct 01 2003 - 16:53:41 EST


Hi!

> > > I'll fix my scripts.
> > > Did you apply this and "add initcall" patches?
> >
> > Yes.
>
> Though, it produces a warning on compile:
>
> kernel/power/swsusp.c:1089: warning: initialization from incompatible pointer type
>
> ..which is because software_resume() returns void. Could you please fix
> this?

Yep. (Cc-ed to list in case I made some stupid mistake). Also added
check: buffer allocation might fail. Please apply,
Pavel

--- tmp/linux/kernel/power/swsusp.c 2003-10-01 23:24:42.000000000 +0200
+++ linux/kernel/power/swsusp.c 2003-10-01 23:18:27.000000000 +0200
@@ -283,6 +283,9 @@
unsigned long address;
struct page *page;

+ if (!buffer)
+ return -ENOMEM;
+
printk( "Writing data to swap (%d pages): ", nr_copy_pages );
for (i=0; i<nr_copy_pages; i++) {
if (!(i%100))
@@ -1046,23 +1051,23 @@
* scheduled program.
*
*/
-static void __init software_resume(void)
+static int __init software_resume(void)
{
if (num_online_cpus() > 1) {
printk(KERN_WARNING "Software Suspend has malfunctioning SMP support. Disabled :(\n");
- return;
+ return -EINVAL;
}
/* We enable the possibility of machine suspend */
software_suspend_enabled = 1;
if (!resume_status)
- return;
+ return 0;

printk( "%s", name_resume );
if (resume_status == NORESUME) {
if(resume_file[0])
read_suspend_image(resume_file, 1);
printk( "disabled\n" );
- return;
+ return 0;
}
MDELAY(1000);

@@ -1071,7 +1076,7 @@

if (!resume_file[0] && resume_status == RESUME_SPECIFIED) {
printk( "suspension device unspecified\n" );
- return;
+ return -EINVAL;
}

printk( "resuming from %s\n", resume_file);
@@ -1082,7 +1087,7 @@

read_failure:
pm_restore_console();
- return;
+ return 0;
}

late_initcall(software_resume);

--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/