Re: PATCH for 2.3.13-pre4 : APM & bogus init.h

jasonq@us.ibm.com
Wed, 4 Aug 1999 17:11:30 -0400


Mr Vignaud,
You have found the bugs that I was looking for. However, your solution removes
the return values from the apm_init () call. I think it would be better to
leave the return values in so that the calling function knows that it errored
out. Here is my fix, which incorporates the fixes you made.

Jason Quartarone

--- linux/arch/i386/kernel/apm.c.orig Wed Aug 4 16:42:13 1999
+++ linux/arch/i386/kernel/apm.c Wed Aug 4 16:04:25 1999
@@ -284,6 +284,7 @@

extern int apm_register_callback(int (*)(apm_event_t));
extern void apm_unregister_callback(int (*)(apm_event_t));
+static int hlt_counter;

/*
* Local variables
@@ -1427,13 +1428,13 @@
* In short, if something bad happens, at least we have a choice
* of just killing the apm thread..
*/
-static void __init apm_init(void)
+static int __init apm_init(void)
{
static struct proc_dir_entry *ent;

if (apm_bios_info.version == 0) {
printk(KERN_INFO "apm: BIOS not found.\n");
- return;
+ return APM_NOT_PRESENT;
}
printk(KERN_INFO
"apm: BIOS version %d.%d Flags 0x%02x (Driver version %s)\n",
@@ -1443,7 +1444,7 @@
driver_version);
if ((apm_bios_info.flags & APM_32_BIT_SUPPORT) == 0) {
printk(KERN_INFO "apm: no 32 bit BIOS support\n");
- return;
+ return APM_32_UNSUPPORTED;
}

/*
@@ -1472,7 +1473,7 @@

if (apm_disabled) {
printk(KERN_NOTICE "apm: disabled on user request.\n");
- return;
+ return APM_DISABLED;
}

#ifdef CONFIG_SMP

--- linux/include/linux/apm_bios.h.orig Tue Aug 3 19:17:05 1999
+++ linux/include/linux/apm_bios.h Wed Aug 4 16:05:51 1999
@@ -19,6 +19,13 @@
typedef unsigned short apm_event_t;
typedef unsigned short apm_eventinfo_t;

+#ifdef CONFIG_APM
+#define powermanagement_idle() do { } while (0)
+#else
+#define powermanagement_idle() do { } while (0)
+#endif
+extern int hlt_counter;
+
#ifdef __KERNEL__

#define APM_40 0x40
@@ -76,7 +83,7 @@
*/
extern struct apm_bios_info apm_bios_info;

-extern void apm_init(void);
+extern int apm_init(void);
extern void apm_setup(char *, int *);

extern int apm_register_callback(int (*callback)(apm_event_t));

--- linux/include/linux/init.h.orig Wed Aug 4 16:25:12 1999
+++ linux/include/linux/init.h Wed Aug 4 16:07:38 1999
@@ -107,7 +107,7 @@
#define __initdata
#define __exitdata
#define __initfunc(__arginit) __arginit
-#defint __initcall
+#define __initcall
/* For assembly routines */
#define __INIT
#define __FINIT

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/