Hi Alan,
[Thanks to Arjan van de Ven for mailing me a patch that I have modified]
Since 2.2.18pre4 now has __setup and module_init stuff in it, here is
a patch to make the APM driver use it (as it does in 2.4.x).
Cheers,
Stephen
--
Stephen Rothwell, Open Source Researcher, Linuxcare, Inc.
+61-2-62628990 tel, +61-2-62628991 fax
[EMAIL PROTECTED], http://www.linuxcare.com/
Linuxcare. Support for the revolution.
diff -ruN 2.2.18pre4/arch/i386/kernel/apm.c 2.2.18pre4-APM/arch/i386/kernel/apm.c
--- 2.2.18pre4/arch/i386/kernel/apm.c Mon Sep 11 10:17:09 2000
+++ 2.2.18pre4-APM/arch/i386/kernel/apm.c Mon Sep 11 14:30:29 2000
@@ -170,10 +170,6 @@
#include <asm/desc.h>
#include <asm/softirq.h>
-/* 2.2-2.3 Compatability defines */
-#define __setup(x, y)
-#define module_init(x)
-
EXPORT_SYMBOL(apm_register_callback);
EXPORT_SYMBOL(apm_unregister_callback);
@@ -1430,7 +1426,7 @@
return 0;
}
-void __init apm_setup(char *str, int *dummy)
+static int __init apm_setup(char *str)
{
int invert;
@@ -1450,6 +1446,7 @@
if (str != NULL)
str += strspn(str, ", \t");
}
+ return 1;
}
__setup("apm=", apm_setup);
@@ -1468,13 +1465,12 @@
&apm_bios_fops
};
-#define APM_INIT_ERROR_RETURN return
-void __init apm_init(void)
+static int __init apm_init(void)
{
if (apm_bios_info.version == 0) {
printk(KERN_INFO "apm: BIOS not found.\n");
- APM_INIT_ERROR_RETURN;
+ return -ENODEV;
}
printk(KERN_INFO
"apm: BIOS version %d.%d Flags 0x%02x (Driver version %s)\n",
@@ -1484,7 +1480,7 @@
driver_version);
if ((apm_bios_info.flags & APM_32_BIT_SUPPORT) == 0) {
printk(KERN_INFO "apm: no 32 bit BIOS support\n");
- APM_INIT_ERROR_RETURN;
+ return -ENODEV;
}
/*
@@ -1513,11 +1509,11 @@
if (apm_disabled) {
printk(KERN_NOTICE "apm: disabled on user request.\n");
- APM_INIT_ERROR_RETURN;
+ return -ENODEV;
}
if ((smp_num_cpus > 1) && !power_off_enabled) {
printk(KERN_NOTICE "apm: disabled - APM is not SMP safe.\n");
- APM_INIT_ERROR_RETURN;
+ return -ENODEV;
}
/*
@@ -1565,7 +1561,7 @@
if (smp_num_cpus > 1) {
printk(KERN_NOTICE
"apm: disabled - APM is not SMP safe (power off active).\n");
- APM_INIT_ERROR_RETURN;
+ return 0;
}
init_timer(&apm_timer);
@@ -1578,6 +1574,7 @@
#ifdef CONFIG_APM_CPU_IDLE
acpi_idle = apm_cpu_idle;
#endif
+ return 0;
}
module_init(apm_init)
diff -ruN 2.2.18pre4/drivers/char/misc.c 2.2.18pre4-APM/drivers/char/misc.c
--- 2.2.18pre4/drivers/char/misc.c Sun Sep 10 17:05:16 2000
+++ 2.2.18pre4-APM/drivers/char/misc.c Mon Sep 11 12:26:39 2000
@@ -43,9 +43,6 @@
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
-#ifdef CONFIG_APM
-#include <linux/apm_bios.h>
-#endif
#include <linux/tty.h>
#include <linux/selection.h>
@@ -240,9 +237,6 @@
#endif
#ifdef CONFIG_DTLK
dtlk_init();
-#endif
-#ifdef CONFIG_APM
- apm_init();
#endif
#ifdef CONFIG_H8
h8_init();
diff -ruN 2.2.18pre4/include/linux/apm_bios.h 2.2.18pre4-APM/include/linux/apm_bios.h
--- 2.2.18pre4/include/linux/apm_bios.h Thu May 4 10:16:51 2000
+++ 2.2.18pre4-APM/include/linux/apm_bios.h Mon Sep 11 12:26:12 2000
@@ -95,9 +95,6 @@
*/
extern struct apm_bios_info apm_bios_info;
-extern void apm_init(void);
-extern void apm_setup(char *, int *);
-
extern int apm_register_callback(int (*callback)(apm_event_t));
extern void apm_unregister_callback(int (*callback)(apm_event_t));
diff -ruN 2.2.18pre4/init/main.c 2.2.18pre4-APM/init/main.c
--- 2.2.18pre4/init/main.c Mon Sep 11 10:17:48 2000
+++ 2.2.18pre4-APM/init/main.c Mon Sep 11 12:31:17 2000
@@ -43,10 +43,6 @@
# include <asm/mtrr.h>
#endif
-#ifdef CONFIG_APM
-#include <linux/apm_bios.h>
-#endif
-
#ifdef CONFIG_DASD
#include <asm/dasd.h>
#endif
@@ -1095,9 +1091,6 @@
#endif
#ifdef CONFIG_PARIDE_PG
{ "pg.", pg_setup },
-#endif
-#ifdef CONFIG_APM
- { "apm=", apm_setup },
#endif
#ifdef CONFIG_N2
{ "n2=", n2_setup },
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/