2.1.59/apm_bios.c: less brutal SMP check

Robert Bihlmeyer (robbe@orcus.priv.at)
25 Oct 1997 17:26:47 +0059


Hi,

in "drivers/char/apm_bios.c" APM is disabled if the kernel was
compiled for SMP. But as newer kernels have SMP enabled per default,
this essentially turns off APM support altogether.

A check that determines at run-time if we're really multiprocessing is
necessary. I suggest the appended patch, which relies on
`smp_num_cpus'.

Robbe

-- 
Robert Bihlmeyer	reads: Deutsch, English, MIME, Latin-1, NO SPAM!
<robbe@orcus.priv.at>	<http://stud2.tuwien.ac.at/~e9426626/sig.html>

diff -u linux/drivers/char/apm_bios.c~ linux/drivers/char/apm_bios.c --- linux/drivers/char/apm_bios.c~ Sat Oct 25 18:25:36 1997 +++ linux/drivers/char/apm_bios.c Sat Oct 25 18:25:36 1997 @@ -78,6 +78,7 @@ #include <linux/miscdevice.h> #include <linux/apm_bios.h> #include <linux/init.h> +#include <linux/smp.h> EXPORT_SYMBOL(apm_register_callback); EXPORT_SYMBOL(apm_unregister_callback); @@ -1074,8 +1075,11 @@ static struct proc_dir_entry *ent; #ifdef __SMP__ - printk(KERN_NOTICE "APM disabled: APM is not SMP safe.\n"); - return; + if (smp_num_cpus>1) + { + printk(KERN_NOTICE "APM disabled: APM is not SMP safe.\n"); + return; + } #endif if (apm_bios_info.version == 0) { printk(KERN_INFO "APM BIOS not found.\n");