[PATCH] 2.3.18ac1 APM as module

Robert H. de Vries (rhdv@rhdv.cistron.nl)
Sat, 11 Sep 1999 17:44:46 +0200


--Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

Currently APM does not compile when configured as a module. Simply #ifdeffing
out the offending code makes the module compile, but then it doesn't load. The
missing symbols have been added to the symbol list. See attached patch.

When testing this patch I found out that when it is loaded as a module, not
many APM functions work. For instance power off on shutdown only works when it
is compiled into the kernel. So at some point I was wondering why it is
possible to compile it as a module when so many things don't work in that
situation? If the answer to that question is that indeed APM should not be
compilable as a module, then the patch is much simpler:
tristate -> bool on line 105 of arch/i386/config.in

Robert

-- 
Robert de Vries
rhdv@rhdv.cistron.nl

--Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD Content-Type: text/x-c; name="apm-2.3.18ac1.patch" Content-Transfer-Encoding: 8bit Content-Description: APM module patch Content-Disposition: attachment; filename="apm-2.3.18ac1.patch"

--- linux-2.3.18ac1-vanilla/kernel/ksyms.c Sat Sep 11 14:34:31 1999 +++ linux-2.3.18ac1-devt/kernel/ksyms.c Sat Sep 11 16:21:31 1999 @@ -112,6 +112,7 @@ EXPORT_SYMBOL(find_vma); EXPORT_SYMBOL(get_unmapped_area); EXPORT_SYMBOL(init_mm); +EXPORT_SYMBOL(check_pgt_cache); /* filesystem internal functions */ EXPORT_SYMBOL(in_group_p); --- linux-2.3.18ac1-vanilla/arch/i386/kernel/apm.c Sat Sep 11 14:34:24 1999 +++ linux-2.3.18ac1-devt/arch/i386/kernel/apm.c Sat Sep 11 15:55:15 1999 @@ -1404,6 +1404,8 @@ return 0; } +#ifndef MODULE + static int __init apm_setup(char *str) { int invert; @@ -1428,6 +1430,8 @@ } __setup("apm=", apm_setup); + +#endif /* !MODULE */ /* * Just start the APM thread. We do NOT want to do APM BIOS --- linux-2.3.18ac1-vanilla/arch/i386/kernel/i386_ksyms.c Sat Sep 11 14:34:24 1999 +++ linux-2.3.18ac1-devt/arch/i386/kernel/i386_ksyms.c Sat Sep 11 17:43:11 1999 @@ -8,6 +8,7 @@ #include <linux/in6.h> #include <linux/interrupt.h> #include <linux/smp_lock.h> +#include <linux/apm_bios.h> #include <asm/semaphore.h> #include <asm/processor.h> @@ -18,9 +19,12 @@ #include <asm/delay.h> #include <asm/irq.h> #include <asm/mmx.h> +#include <asm/desc.h> extern void dump_thread(struct pt_regs *, struct user *); extern int dump_fpu(elf_fpregset_t *); +extern unsigned long get_cmos_time(void); +extern int hlt_counter; #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) extern struct drive_info_struct drive_info; @@ -73,6 +77,12 @@ EXPORT_SYMBOL(__generic_copy_from_user); EXPORT_SYMBOL(__generic_copy_to_user); EXPORT_SYMBOL(strlen_user); + +/* needed for APM */ +EXPORT_SYMBOL(get_cmos_time); +EXPORT_SYMBOL(apm_bios_info); +EXPORT_SYMBOL(hlt_counter); +EXPORT_SYMBOL(gdt); #ifdef CONFIG_X86_USE_3DNOW EXPORT_SYMBOL(_mmx_memcpy);

--Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD--

- 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/