aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2008-01-30 07:32:32 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:32:32 -0500
commit3f4380a1e0ea44bc1062ca55e8e479ddcda369fc (patch)
tree10cd7f0e9dd1c780c5584562ebef5b561adf7867 /arch
parent1c858087cd49d36b2f25b4fc2a47e39ac6cf09df (diff)
x86: get rid of checkpatch.pl complains on apm_32.c
This patch eliminates most of code-style errors discovered by checkpatch.pl on arch/x86/kernel/apm_32.c no code changed: text data bss dec hex filename 12142 1837 84 14063 36ef apm_32.o.before 12142 1837 84 14063 36ef apm_32.o.after md5: 2676b881ad55e387da4a995e8b9ee372 apm_32.o.before.asm 2676b881ad55e387da4a995e8b9ee372 apm_32.o.after.asm Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/apm_32.c366
1 files changed, 196 insertions, 170 deletions
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 2467df7eca0b..955dd43b1676 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -323,7 +323,7 @@ extern int (*console_blank_hook)(int);
323/* 323/*
324 * Ignore suspend events for this amount of time after a resume 324 * Ignore suspend events for this amount of time after a resume
325 */ 325 */
326#define DEFAULT_BOUNCE_INTERVAL (3 * HZ) 326#define DEFAULT_BOUNCE_INTERVAL (3 * HZ)
327 327
328/* 328/*
329 * Maximum number of events stored 329 * Maximum number of events stored
@@ -335,7 +335,7 @@ extern int (*console_blank_hook)(int);
335 */ 335 */
336struct apm_user { 336struct apm_user {
337 int magic; 337 int magic;
338 struct apm_user * next; 338 struct apm_user *next;
339 unsigned int suser: 1; 339 unsigned int suser: 1;
340 unsigned int writer: 1; 340 unsigned int writer: 1;
341 unsigned int reader: 1; 341 unsigned int reader: 1;
@@ -371,44 +371,44 @@ struct apm_user {
371static struct { 371static struct {
372 unsigned long offset; 372 unsigned long offset;
373 unsigned short segment; 373 unsigned short segment;
374} apm_bios_entry; 374} apm_bios_entry;
375static int clock_slowed; 375static int clock_slowed;
376static int idle_threshold __read_mostly = DEFAULT_IDLE_THRESHOLD; 376static int idle_threshold __read_mostly = DEFAULT_IDLE_THRESHOLD;
377static int idle_period __read_mostly = DEFAULT_IDLE_PERIOD; 377static int idle_period __read_mostly = DEFAULT_IDLE_PERIOD;
378static int set_pm_idle; 378static int set_pm_idle;
379static int suspends_pending; 379static int suspends_pending;
380static int standbys_pending; 380static int standbys_pending;
381static int ignore_sys_suspend; 381static int ignore_sys_suspend;
382static int ignore_normal_resume; 382static int ignore_normal_resume;
383static int bounce_interval __read_mostly = DEFAULT_BOUNCE_INTERVAL; 383static int bounce_interval __read_mostly = DEFAULT_BOUNCE_INTERVAL;
384 384
385static int debug __read_mostly; 385static int debug __read_mostly;
386static int smp __read_mostly; 386static int smp __read_mostly;
387static int apm_disabled = -1; 387static int apm_disabled = -1;
388#ifdef CONFIG_SMP 388#ifdef CONFIG_SMP
389static int power_off; 389static int power_off;
390#else 390#else
391static int power_off = 1; 391static int power_off = 1;
392#endif 392#endif
393#ifdef CONFIG_APM_REAL_MODE_POWER_OFF 393#ifdef CONFIG_APM_REAL_MODE_POWER_OFF
394static int realmode_power_off = 1; 394static int realmode_power_off = 1;
395#else 395#else
396static int realmode_power_off; 396static int realmode_power_off;
397#endif 397#endif
398#ifdef CONFIG_APM_ALLOW_INTS 398#ifdef CONFIG_APM_ALLOW_INTS
399static int allow_ints = 1; 399static int allow_ints = 1;
400#else 400#else
401static int allow_ints; 401static int allow_ints;
402#endif 402#endif
403static int broken_psr; 403static int broken_psr;
404 404
405static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); 405static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
406static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); 406static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
407static struct apm_user * user_list; 407static struct apm_user *user_list;
408static DEFINE_SPINLOCK(user_list_lock); 408static DEFINE_SPINLOCK(user_list_lock);
409static const struct desc_struct bad_bios_desc = { { { 0, 0x00409200 } } }; 409static const struct desc_struct bad_bios_desc = { { { 0, 0x00409200 } } };
410 410
411static const char driver_version[] = "1.16ac"; /* no spaces */ 411static const char driver_version[] = "1.16ac"; /* no spaces */
412 412
413static struct task_struct *kapmd_task; 413static struct task_struct *kapmd_task;
414 414
@@ -416,7 +416,7 @@ static struct task_struct *kapmd_task;
416 * APM event names taken from the APM 1.2 specification. These are 416 * APM event names taken from the APM 1.2 specification. These are
417 * the message codes that the BIOS uses to tell us about events 417 * the message codes that the BIOS uses to tell us about events
418 */ 418 */
419static const char * const apm_event_name[] = { 419static const char * const apm_event_name[] = {
420 "system standby", 420 "system standby",
421 "system suspend", 421 "system suspend",
422 "normal resume", 422 "normal resume",
@@ -434,14 +434,14 @@ static const char * const apm_event_name[] = {
434 434
435typedef struct lookup_t { 435typedef struct lookup_t {
436 int key; 436 int key;
437 char * msg; 437 char *msg;
438} lookup_t; 438} lookup_t;
439 439
440/* 440/*
441 * The BIOS returns a set of standard error codes in AX when the 441 * The BIOS returns a set of standard error codes in AX when the
442 * carry flag is set. 442 * carry flag is set.
443 */ 443 */
444 444
445static const lookup_t error_table[] = { 445static const lookup_t error_table[] = {
446/* N/A { APM_SUCCESS, "Operation succeeded" }, */ 446/* N/A { APM_SUCCESS, "Operation succeeded" }, */
447 { APM_DISABLED, "Power management disabled" }, 447 { APM_DISABLED, "Power management disabled" },
@@ -471,24 +471,25 @@ static const lookup_t error_table[] = {
471 * Write a meaningful log entry to the kernel log in the event of 471 * Write a meaningful log entry to the kernel log in the event of
472 * an APM error. 472 * an APM error.
473 */ 473 */
474 474
475static void apm_error(char *str, int err) 475static void apm_error(char *str, int err)
476{ 476{
477 int i; 477 int i;
478 478
479 for (i = 0; i < ERROR_COUNT; i++) 479 for (i = 0; i < ERROR_COUNT; i++)
480 if (error_table[i].key == err) break; 480 if (error_table[i].key == err)
481 break;
481 if (i < ERROR_COUNT) 482 if (i < ERROR_COUNT)
482 printk(KERN_NOTICE "apm: %s: %s\n", str, error_table[i].msg); 483 printk(KERN_NOTICE "apm: %s: %s\n", str, error_table[i].msg);
483 else 484 else
484 printk(KERN_NOTICE "apm: %s: unknown error code %#2.2x\n", 485 printk(KERN_NOTICE "apm: %s: unknown error code %#2.2x\n",
485 str, err); 486 str, err);
486} 487}
487 488
488/* 489/*
489 * Lock APM functionality to physical CPU 0 490 * Lock APM functionality to physical CPU 0
490 */ 491 */
491 492
492#ifdef CONFIG_SMP 493#ifdef CONFIG_SMP
493 494
494static cpumask_t apm_save_cpus(void) 495static cpumask_t apm_save_cpus(void)
@@ -510,7 +511,7 @@ static inline void apm_restore_cpus(cpumask_t mask)
510/* 511/*
511 * No CPU lockdown needed on a uniprocessor 512 * No CPU lockdown needed on a uniprocessor
512 */ 513 */
513 514
514#define apm_save_cpus() (current->cpus_allowed) 515#define apm_save_cpus() (current->cpus_allowed)
515#define apm_restore_cpus(x) (void)(x) 516#define apm_restore_cpus(x) (void)(x)
516 517
@@ -589,7 +590,7 @@ static inline void apm_irq_restore(unsigned long flags)
589 * code is returned in AH (bits 8-15 of eax) and this function 590 * code is returned in AH (bits 8-15 of eax) and this function
590 * returns non-zero. 591 * returns non-zero.
591 */ 592 */
592 593
593static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in, 594static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in,
594 u32 *eax, u32 *ebx, u32 *ecx, u32 *edx, u32 *esi) 595 u32 *eax, u32 *ebx, u32 *ecx, u32 *edx, u32 *esi)
595{ 596{
@@ -601,7 +602,7 @@ static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in,
601 struct desc_struct *gdt; 602 struct desc_struct *gdt;
602 603
603 cpus = apm_save_cpus(); 604 cpus = apm_save_cpus();
604 605
605 cpu = get_cpu(); 606 cpu = get_cpu();
606 gdt = get_cpu_gdt_table(cpu); 607 gdt = get_cpu_gdt_table(cpu);
607 save_desc_40 = gdt[0x40 / 8]; 608 save_desc_40 = gdt[0x40 / 8];
@@ -615,7 +616,7 @@ static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in,
615 gdt[0x40 / 8] = save_desc_40; 616 gdt[0x40 / 8] = save_desc_40;
616 put_cpu(); 617 put_cpu();
617 apm_restore_cpus(cpus); 618 apm_restore_cpus(cpus);
618 619
619 return *eax & 0xff; 620 return *eax & 0xff;
620} 621}
621 622
@@ -644,7 +645,7 @@ static u8 apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax)
644 struct desc_struct *gdt; 645 struct desc_struct *gdt;
645 646
646 cpus = apm_save_cpus(); 647 cpus = apm_save_cpus();
647 648
648 cpu = get_cpu(); 649 cpu = get_cpu();
649 gdt = get_cpu_gdt_table(cpu); 650 gdt = get_cpu_gdt_table(cpu);
650 save_desc_40 = gdt[0x40 / 8]; 651 save_desc_40 = gdt[0x40 / 8];
@@ -679,7 +680,7 @@ static u8 apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax)
679 680
680static int apm_driver_version(u_short *val) 681static int apm_driver_version(u_short *val)
681{ 682{
682 u32 eax; 683 u32 eax;
683 684
684 if (apm_bios_call_simple(APM_FUNC_VERSION, 0, *val, &eax)) 685 if (apm_bios_call_simple(APM_FUNC_VERSION, 0, *val, &eax))
685 return (eax >> 8) & 0xff; 686 return (eax >> 8) & 0xff;
@@ -703,16 +704,16 @@ static int apm_driver_version(u_short *val)
703 * that APM 1.2 is in use. If no messges are pending the value 0x80 704 * that APM 1.2 is in use. If no messges are pending the value 0x80
704 * is returned (No power management events pending). 705 * is returned (No power management events pending).
705 */ 706 */
706 707
707static int apm_get_event(apm_event_t *event, apm_eventinfo_t *info) 708static int apm_get_event(apm_event_t *event, apm_eventinfo_t *info)
708{ 709{
709 u32 eax; 710 u32 eax;
710 u32 ebx; 711 u32 ebx;
711 u32 ecx; 712 u32 ecx;
712 u32 dummy; 713 u32 dummy;
713 714
714 if (apm_bios_call(APM_FUNC_GET_EVENT, 0, 0, &eax, &ebx, &ecx, 715 if (apm_bios_call(APM_FUNC_GET_EVENT, 0, 0, &eax, &ebx, &ecx,
715 &dummy, &dummy)) 716 &dummy, &dummy))
716 return (eax >> 8) & 0xff; 717 return (eax >> 8) & 0xff;
717 *event = ebx; 718 *event = ebx;
718 if (apm_info.connection_version < 0x0102) 719 if (apm_info.connection_version < 0x0102)
@@ -735,10 +736,10 @@ static int apm_get_event(apm_event_t *event, apm_eventinfo_t *info)
735 * The state holds the state to transition to, which may in fact 736 * The state holds the state to transition to, which may in fact
736 * be an acceptance of a BIOS requested state change. 737 * be an acceptance of a BIOS requested state change.
737 */ 738 */
738 739
739static int set_power_state(u_short what, u_short state) 740static int set_power_state(u_short what, u_short state)
740{ 741{
741 u32 eax; 742 u32 eax;
742 743
743 if (apm_bios_call_simple(APM_FUNC_SET_STATE, what, state, &eax)) 744 if (apm_bios_call_simple(APM_FUNC_SET_STATE, what, state, &eax))
744 return (eax >> 8) & 0xff; 745 return (eax >> 8) & 0xff;
@@ -751,7 +752,7 @@ static int set_power_state(u_short what, u_short state)
751 * 752 *
752 * Transition the entire system into a new APM power state. 753 * Transition the entire system into a new APM power state.
753 */ 754 */
754 755
755static int set_system_power_state(u_short state) 756static int set_system_power_state(u_short state)
756{ 757{
757 return set_power_state(APM_DEVICE_ALL, state); 758 return set_power_state(APM_DEVICE_ALL, state);
@@ -765,13 +766,13 @@ static int set_system_power_state(u_short state)
765 * to handle the idle request. On a success the function returns 1 766 * to handle the idle request. On a success the function returns 1
766 * if the BIOS did clock slowing or 0 otherwise. 767 * if the BIOS did clock slowing or 0 otherwise.
767 */ 768 */
768 769
769static int apm_do_idle(void) 770static int apm_do_idle(void)
770{ 771{
771 u32 eax; 772 u32 eax;
772 u8 ret = 0; 773 u8 ret = 0;
773 int idled = 0; 774 int idled = 0;
774 int polling; 775 int polling;
775 776
776 polling = !!(current_thread_info()->status & TS_POLLING); 777 polling = !!(current_thread_info()->status & TS_POLLING);
777 if (polling) { 778 if (polling) {
@@ -798,10 +799,9 @@ static int apm_do_idle(void)
798 /* This always fails on some SMP boards running UP kernels. 799 /* This always fails on some SMP boards running UP kernels.
799 * Only report the failure the first 5 times. 800 * Only report the failure the first 5 times.
800 */ 801 */
801 if (++t < 5) 802 if (++t < 5) {
802 {
803 printk(KERN_DEBUG "apm_do_idle failed (%d)\n", 803 printk(KERN_DEBUG "apm_do_idle failed (%d)\n",
804 (eax >> 8) & 0xff); 804 (eax >> 8) & 0xff);
805 t = jiffies; 805 t = jiffies;
806 } 806 }
807 return -1; 807 return -1;
@@ -813,15 +813,15 @@ static int apm_do_idle(void)
813/** 813/**
814 * apm_do_busy - inform the BIOS the CPU is busy 814 * apm_do_busy - inform the BIOS the CPU is busy
815 * 815 *
816 * Request that the BIOS brings the CPU back to full performance. 816 * Request that the BIOS brings the CPU back to full performance.
817 */ 817 */
818 818
819static void apm_do_busy(void) 819static void apm_do_busy(void)
820{ 820{
821 u32 dummy; 821 u32 dummy;
822 822
823 if (clock_slowed || ALWAYS_CALL_BUSY) { 823 if (clock_slowed || ALWAYS_CALL_BUSY) {
824 (void) apm_bios_call_simple(APM_FUNC_BUSY, 0, 0, &dummy); 824 (void)apm_bios_call_simple(APM_FUNC_BUSY, 0, 0, &dummy);
825 clock_slowed = 0; 825 clock_slowed = 0;
826 } 826 }
827} 827}
@@ -832,15 +832,15 @@ static void apm_do_busy(void)
832 * power management - we probably want 832 * power management - we probably want
833 * to conserve power. 833 * to conserve power.
834 */ 834 */
835#define IDLE_CALC_LIMIT (HZ * 100) 835#define IDLE_CALC_LIMIT (HZ * 100)
836#define IDLE_LEAKY_MAX 16 836#define IDLE_LEAKY_MAX 16
837 837
838static void (*original_pm_idle)(void) __read_mostly; 838static void (*original_pm_idle)(void) __read_mostly;
839 839
840/** 840/**
841 * apm_cpu_idle - cpu idling for APM capable Linux 841 * apm_cpu_idle - cpu idling for APM capable Linux
842 * 842 *
843 * This is the idling function the kernel executes when APM is available. It 843 * This is the idling function the kernel executes when APM is available. It
844 * tries to do BIOS powermanagement based on the average system idle time. 844 * tries to do BIOS powermanagement based on the average system idle time.
845 * Furthermore it calls the system default idle routine. 845 * Furthermore it calls the system default idle routine.
846 */ 846 */
@@ -881,7 +881,8 @@ recalc:
881 881
882 t = jiffies; 882 t = jiffies;
883 switch (apm_do_idle()) { 883 switch (apm_do_idle()) {
884 case 0: apm_idle_done = 1; 884 case 0:
885 apm_idle_done = 1;
885 if (t != jiffies) { 886 if (t != jiffies) {
886 if (bucket) { 887 if (bucket) {
887 bucket = IDLE_LEAKY_MAX; 888 bucket = IDLE_LEAKY_MAX;
@@ -892,7 +893,8 @@ recalc:
892 continue; 893 continue;
893 } 894 }
894 break; 895 break;
895 case 1: apm_idle_done = 1; 896 case 1:
897 apm_idle_done = 1;
896 break; 898 break;
897 default: /* BIOS refused */ 899 default: /* BIOS refused */
898 break; 900 break;
@@ -920,10 +922,10 @@ recalc:
920 * the SMP call on CPU0 as some systems will only honour this call 922 * the SMP call on CPU0 as some systems will only honour this call
921 * on their first cpu. 923 * on their first cpu.
922 */ 924 */
923 925
924static void apm_power_off(void) 926static void apm_power_off(void)
925{ 927{
926 unsigned char po_bios_call[] = { 928 unsigned char po_bios_call[] = {
927 0xb8, 0x00, 0x10, /* movw $0x1000,ax */ 929 0xb8, 0x00, 0x10, /* movw $0x1000,ax */
928 0x8e, 0xd0, /* movw ax,ss */ 930 0x8e, 0xd0, /* movw ax,ss */
929 0xbc, 0x00, 0xf0, /* movw $0xf000,sp */ 931 0xbc, 0x00, 0xf0, /* movw $0xf000,sp */
@@ -934,13 +936,12 @@ static void apm_power_off(void)
934 }; 936 };
935 937
936 /* Some bioses don't like being called from CPU != 0 */ 938 /* Some bioses don't like being called from CPU != 0 */
937 if (apm_info.realmode_power_off) 939 if (apm_info.realmode_power_off) {
938 {
939 (void)apm_save_cpus(); 940 (void)apm_save_cpus();
940 machine_real_restart(po_bios_call, sizeof(po_bios_call)); 941 machine_real_restart(po_bios_call, sizeof(po_bios_call));
942 } else {
943 (void)set_system_power_state(APM_STATE_OFF);
941 } 944 }
942 else
943 (void) set_system_power_state(APM_STATE_OFF);
944} 945}
945 946
946#ifdef CONFIG_APM_DO_ENABLE 947#ifdef CONFIG_APM_DO_ENABLE
@@ -949,17 +950,17 @@ static void apm_power_off(void)
949 * apm_enable_power_management - enable BIOS APM power management 950 * apm_enable_power_management - enable BIOS APM power management
950 * @enable: enable yes/no 951 * @enable: enable yes/no
951 * 952 *
952 * Enable or disable the APM BIOS power services. 953 * Enable or disable the APM BIOS power services.
953 */ 954 */
954 955
955static int apm_enable_power_management(int enable) 956static int apm_enable_power_management(int enable)
956{ 957{
957 u32 eax; 958 u32 eax;
958 959
959 if ((enable == 0) && (apm_info.bios.flags & APM_BIOS_DISENGAGED)) 960 if ((enable == 0) && (apm_info.bios.flags & APM_BIOS_DISENGAGED))
960 return APM_NOT_ENGAGED; 961 return APM_NOT_ENGAGED;
961 if (apm_bios_call_simple(APM_FUNC_ENABLE_PM, APM_DEVICE_BALL, 962 if (apm_bios_call_simple(APM_FUNC_ENABLE_PM, APM_DEVICE_BALL,
962 enable, &eax)) 963 enable, &eax))
963 return (eax >> 8) & 0xff; 964 return (eax >> 8) & 0xff;
964 if (enable) 965 if (enable)
965 apm_info.bios.flags &= ~APM_BIOS_DISABLED; 966 apm_info.bios.flags &= ~APM_BIOS_DISABLED;
@@ -982,19 +983,19 @@ static int apm_enable_power_management(int enable)
982 * if reported is a lifetime in secodnds/minutes at current powwer 983 * if reported is a lifetime in secodnds/minutes at current powwer
983 * consumption. 984 * consumption.
984 */ 985 */
985 986
986static int apm_get_power_status(u_short *status, u_short *bat, u_short *life) 987static int apm_get_power_status(u_short *status, u_short *bat, u_short *life)
987{ 988{
988 u32 eax; 989 u32 eax;
989 u32 ebx; 990 u32 ebx;
990 u32 ecx; 991 u32 ecx;
991 u32 edx; 992 u32 edx;
992 u32 dummy; 993 u32 dummy;
993 994
994 if (apm_info.get_power_status_broken) 995 if (apm_info.get_power_status_broken)
995 return APM_32_UNSUPPORTED; 996 return APM_32_UNSUPPORTED;
996 if (apm_bios_call(APM_FUNC_GET_STATUS, APM_DEVICE_ALL, 0, 997 if (apm_bios_call(APM_FUNC_GET_STATUS, APM_DEVICE_ALL, 0,
997 &eax, &ebx, &ecx, &edx, &dummy)) 998 &eax, &ebx, &ecx, &edx, &dummy))
998 return (eax >> 8) & 0xff; 999 return (eax >> 8) & 0xff;
999 *status = ebx; 1000 *status = ebx;
1000 *bat = ecx; 1001 *bat = ecx;
@@ -1010,11 +1011,11 @@ static int apm_get_power_status(u_short *status, u_short *bat, u_short *life)
1010static int apm_get_battery_status(u_short which, u_short *status, 1011static int apm_get_battery_status(u_short which, u_short *status,
1011 u_short *bat, u_short *life, u_short *nbat) 1012 u_short *bat, u_short *life, u_short *nbat)
1012{ 1013{
1013 u32 eax; 1014 u32 eax;
1014 u32 ebx; 1015 u32 ebx;
1015 u32 ecx; 1016 u32 ecx;
1016 u32 edx; 1017 u32 edx;
1017 u32 esi; 1018 u32 esi;
1018 1019
1019 if (apm_info.connection_version < 0x0102) { 1020 if (apm_info.connection_version < 0x0102) {
1020 /* pretend we only have one battery. */ 1021 /* pretend we only have one battery. */
@@ -1025,7 +1026,7 @@ static int apm_get_battery_status(u_short which, u_short *status,
1025 } 1026 }
1026 1027
1027 if (apm_bios_call(APM_FUNC_GET_STATUS, (0x8000 | (which)), 0, &eax, 1028 if (apm_bios_call(APM_FUNC_GET_STATUS, (0x8000 | (which)), 0, &eax,
1028 &ebx, &ecx, &edx, &esi)) 1029 &ebx, &ecx, &edx, &esi))
1029 return (eax >> 8) & 0xff; 1030 return (eax >> 8) & 0xff;
1030 *status = ebx; 1031 *status = ebx;
1031 *bat = ecx; 1032 *bat = ecx;
@@ -1043,10 +1044,10 @@ static int apm_get_battery_status(u_short which, u_short *status,
1043 * Activate or deactive power management on either a specific device 1044 * Activate or deactive power management on either a specific device
1044 * or the entire system (%APM_DEVICE_ALL). 1045 * or the entire system (%APM_DEVICE_ALL).
1045 */ 1046 */
1046 1047
1047static int apm_engage_power_management(u_short device, int enable) 1048static int apm_engage_power_management(u_short device, int enable)
1048{ 1049{
1049 u32 eax; 1050 u32 eax;
1050 1051
1051 if ((enable == 0) && (device == APM_DEVICE_ALL) 1052 if ((enable == 0) && (device == APM_DEVICE_ALL)
1052 && (apm_info.bios.flags & APM_BIOS_DISABLED)) 1053 && (apm_info.bios.flags & APM_BIOS_DISABLED))
@@ -1073,7 +1074,7 @@ static int apm_engage_power_management(u_short device, int enable)
1073 * all video devices. Typically the BIOS will do laptop backlight and 1074 * all video devices. Typically the BIOS will do laptop backlight and
1074 * monitor powerdown for us. 1075 * monitor powerdown for us.
1075 */ 1076 */
1076 1077
1077static int apm_console_blank(int blank) 1078static int apm_console_blank(int blank)
1078{ 1079{
1079 int error = APM_NOT_ENGAGED; /* silence gcc */ 1080 int error = APM_NOT_ENGAGED; /* silence gcc */
@@ -1125,7 +1126,7 @@ static apm_event_t get_queued_event(struct apm_user *as)
1125 1126
1126static void queue_event(apm_event_t event, struct apm_user *sender) 1127static void queue_event(apm_event_t event, struct apm_user *sender)
1127{ 1128{
1128 struct apm_user * as; 1129 struct apm_user *as;
1129 1130
1130 spin_lock(&user_list_lock); 1131 spin_lock(&user_list_lock);
1131 if (user_list == NULL) 1132 if (user_list == NULL)
@@ -1185,7 +1186,7 @@ static void reinit_timer(void)
1185 1186
1186static int suspend(int vetoable) 1187static int suspend(int vetoable)
1187{ 1188{
1188 int err; 1189 int err;
1189 struct apm_user *as; 1190 struct apm_user *as;
1190 1191
1191 if (pm_send_all(PM_SUSPEND, (void *)3)) { 1192 if (pm_send_all(PM_SUSPEND, (void *)3)) {
@@ -1238,7 +1239,7 @@ static int suspend(int vetoable)
1238 1239
1239static void standby(void) 1240static void standby(void)
1240{ 1241{
1241 int err; 1242 int err;
1242 1243
1243 local_irq_disable(); 1244 local_irq_disable();
1244 device_power_down(PMSG_SUSPEND); 1245 device_power_down(PMSG_SUSPEND);
@@ -1255,8 +1256,8 @@ static void standby(void)
1255 1256
1256static apm_event_t get_event(void) 1257static apm_event_t get_event(void)
1257{ 1258{
1258 int error; 1259 int error;
1259 apm_event_t event = APM_NO_EVENTS; /* silence gcc */ 1260 apm_event_t event = APM_NO_EVENTS; /* silence gcc */
1260 apm_eventinfo_t info; 1261 apm_eventinfo_t info;
1261 1262
1262 static int notified; 1263 static int notified;
@@ -1274,9 +1275,9 @@ static apm_event_t get_event(void)
1274 1275
1275static void check_events(void) 1276static void check_events(void)
1276{ 1277{
1277 apm_event_t event; 1278 apm_event_t event;
1278 static unsigned long last_resume; 1279 static unsigned long last_resume;
1279 static int ignore_bounce; 1280 static int ignore_bounce;
1280 1281
1281 while ((event = get_event()) != 0) { 1282 while ((event = get_event()) != 0) {
1282 if (debug) { 1283 if (debug) {
@@ -1356,7 +1357,7 @@ static void check_events(void)
1356 /* 1357 /*
1357 * We are not allowed to reject a critical suspend. 1358 * We are not allowed to reject a critical suspend.
1358 */ 1359 */
1359 (void) suspend(0); 1360 (void)suspend(0);
1360 break; 1361 break;
1361 } 1362 }
1362 } 1363 }
@@ -1364,12 +1365,12 @@ static void check_events(void)
1364 1365
1365static void apm_event_handler(void) 1366static void apm_event_handler(void)
1366{ 1367{
1367 static int pending_count = 4; 1368 static int pending_count = 4;
1368 int err; 1369 int err;
1369 1370
1370 if ((standbys_pending > 0) || (suspends_pending > 0)) { 1371 if ((standbys_pending > 0) || (suspends_pending > 0)) {
1371 if ((apm_info.connection_version > 0x100) && 1372 if ((apm_info.connection_version > 0x100) &&
1372 (pending_count-- <= 0)) { 1373 (pending_count-- <= 0)) {
1373 pending_count = 4; 1374 pending_count = 4;
1374 if (debug) 1375 if (debug)
1375 printk(KERN_DEBUG "apm: setting state busy\n"); 1376 printk(KERN_DEBUG "apm: setting state busy\n");
@@ -1417,9 +1418,9 @@ static int check_apm_user(struct apm_user *as, const char *func)
1417 1418
1418static ssize_t do_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos) 1419static ssize_t do_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos)
1419{ 1420{
1420 struct apm_user * as; 1421 struct apm_user *as;
1421 int i; 1422 int i;
1422 apm_event_t event; 1423 apm_event_t event;
1423 1424
1424 as = fp->private_data; 1425 as = fp->private_data;
1425 if (check_apm_user(as, "read")) 1426 if (check_apm_user(as, "read"))
@@ -1458,9 +1459,9 @@ static ssize_t do_read(struct file *fp, char __user *buf, size_t count, loff_t *
1458 return 0; 1459 return 0;
1459} 1460}
1460 1461
1461static unsigned int do_poll(struct file *fp, poll_table * wait) 1462static unsigned int do_poll(struct file *fp, poll_table *wait)
1462{ 1463{
1463 struct apm_user * as; 1464 struct apm_user *as;
1464 1465
1465 as = fp->private_data; 1466 as = fp->private_data;
1466 if (check_apm_user(as, "poll")) 1467 if (check_apm_user(as, "poll"))
@@ -1471,10 +1472,10 @@ static unsigned int do_poll(struct file *fp, poll_table * wait)
1471 return 0; 1472 return 0;
1472} 1473}
1473 1474
1474static int do_ioctl(struct inode * inode, struct file *filp, 1475static int do_ioctl(struct inode *inode, struct file *filp,
1475 u_int cmd, u_long arg) 1476 u_int cmd, u_long arg)
1476{ 1477{
1477 struct apm_user * as; 1478 struct apm_user *as;
1478 1479
1479 as = filp->private_data; 1480 as = filp->private_data;
1480 if (check_apm_user(as, "ioctl")) 1481 if (check_apm_user(as, "ioctl"))
@@ -1514,9 +1515,9 @@ static int do_ioctl(struct inode * inode, struct file *filp,
1514 return 0; 1515 return 0;
1515} 1516}
1516 1517
1517static int do_release(struct inode * inode, struct file * filp) 1518static int do_release(struct inode *inode, struct file *filp)
1518{ 1519{
1519 struct apm_user * as; 1520 struct apm_user *as;
1520 1521
1521 as = filp->private_data; 1522 as = filp->private_data;
1522 if (check_apm_user(as, "release")) 1523 if (check_apm_user(as, "release"))
@@ -1532,11 +1533,11 @@ static int do_release(struct inode * inode, struct file * filp)
1532 if (suspends_pending <= 0) 1533 if (suspends_pending <= 0)
1533 (void) suspend(1); 1534 (void) suspend(1);
1534 } 1535 }
1535 spin_lock(&user_list_lock); 1536 spin_lock(&user_list_lock);
1536 if (user_list == as) 1537 if (user_list == as)
1537 user_list = as->next; 1538 user_list = as->next;
1538 else { 1539 else {
1539 struct apm_user * as1; 1540 struct apm_user *as1;
1540 1541
1541 for (as1 = user_list; 1542 for (as1 = user_list;
1542 (as1 != NULL) && (as1->next != as); 1543 (as1 != NULL) && (as1->next != as);
@@ -1552,9 +1553,9 @@ static int do_release(struct inode * inode, struct file * filp)
1552 return 0; 1553 return 0;
1553} 1554}
1554 1555
1555static int do_open(struct inode * inode, struct file * filp) 1556static int do_open(struct inode *inode, struct file *filp)
1556{ 1557{
1557 struct apm_user * as; 1558 struct apm_user *as;
1558 1559
1559 as = kmalloc(sizeof(*as), GFP_KERNEL); 1560 as = kmalloc(sizeof(*as), GFP_KERNEL);
1560 if (as == NULL) { 1561 if (as == NULL) {
@@ -1568,7 +1569,7 @@ static int do_open(struct inode * inode, struct file * filp)
1568 as->suspends_read = as->standbys_read = 0; 1569 as->suspends_read = as->standbys_read = 0;
1569 /* 1570 /*
1570 * XXX - this is a tiny bit broken, when we consider BSD 1571 * XXX - this is a tiny bit broken, when we consider BSD
1571 * process accounting. If the device is opened by root, we 1572 * process accounting. If the device is opened by root, we
1572 * instantly flag that we used superuser privs. Who knows, 1573 * instantly flag that we used superuser privs. Who knows,
1573 * we might close the device immediately without doing a 1574 * we might close the device immediately without doing a
1574 * privileged operation -- cevans 1575 * privileged operation -- cevans
@@ -1651,16 +1652,16 @@ static int proc_apm_show(struct seq_file *m, void *v)
1651 8) min = minutes; sec = seconds */ 1652 8) min = minutes; sec = seconds */
1652 1653
1653 seq_printf(m, "%s %d.%d 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n", 1654 seq_printf(m, "%s %d.%d 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",
1654 driver_version, 1655 driver_version,
1655 (apm_info.bios.version >> 8) & 0xff, 1656 (apm_info.bios.version >> 8) & 0xff,
1656 apm_info.bios.version & 0xff, 1657 apm_info.bios.version & 0xff,
1657 apm_info.bios.flags, 1658 apm_info.bios.flags,
1658 ac_line_status, 1659 ac_line_status,
1659 battery_status, 1660 battery_status,
1660 battery_flag, 1661 battery_flag,
1661 percentage, 1662 percentage,
1662 time_units, 1663 time_units,
1663 units); 1664 units);
1664 return 0; 1665 return 0;
1665} 1666}
1666 1667
@@ -1683,8 +1684,8 @@ static int apm(void *unused)
1683 unsigned short cx; 1684 unsigned short cx;
1684 unsigned short dx; 1685 unsigned short dx;
1685 int error; 1686 int error;
1686 char * power_stat; 1687 char *power_stat;
1687 char * bat_stat; 1688 char *bat_stat;
1688 1689
1689#ifdef CONFIG_SMP 1690#ifdef CONFIG_SMP
1690 /* 2002/08/01 - WT 1691 /* 2002/08/01 - WT
@@ -1743,23 +1744,41 @@ static int apm(void *unused)
1743 } 1744 }
1744 } 1745 }
1745 1746
1746 if (debug && (num_online_cpus() == 1 || smp )) { 1747 if (debug && (num_online_cpus() == 1 || smp)) {
1747 error = apm_get_power_status(&bx, &cx, &dx); 1748 error = apm_get_power_status(&bx, &cx, &dx);
1748 if (error) 1749 if (error)
1749 printk(KERN_INFO "apm: power status not available\n"); 1750 printk(KERN_INFO "apm: power status not available\n");
1750 else { 1751 else {
1751 switch ((bx >> 8) & 0xff) { 1752 switch ((bx >> 8) & 0xff) {
1752 case 0: power_stat = "off line"; break; 1753 case 0:
1753 case 1: power_stat = "on line"; break; 1754 power_stat = "off line";
1754 case 2: power_stat = "on backup power"; break; 1755 break;
1755 default: power_stat = "unknown"; break; 1756 case 1:
1757 power_stat = "on line";
1758 break;
1759 case 2:
1760 power_stat = "on backup power";
1761 break;
1762 default:
1763 power_stat = "unknown";
1764 break;
1756 } 1765 }
1757 switch (bx & 0xff) { 1766 switch (bx & 0xff) {
1758 case 0: bat_stat = "high"; break; 1767 case 0:
1759 case 1: bat_stat = "low"; break; 1768 bat_stat = "high";
1760 case 2: bat_stat = "critical"; break; 1769 break;
1761 case 3: bat_stat = "charging"; break; 1770 case 1:
1762 default: bat_stat = "unknown"; break; 1771 bat_stat = "low";
1772 break;
1773 case 2:
1774 bat_stat = "critical";
1775 break;
1776 case 3:
1777 bat_stat = "charging";
1778 break;
1779 default:
1780 bat_stat = "unknown";
1781 break;
1763 } 1782 }
1764 printk(KERN_INFO 1783 printk(KERN_INFO
1765 "apm: AC %s, battery status %s, battery life ", 1784 "apm: AC %s, battery status %s, battery life ",
@@ -1776,8 +1795,8 @@ static int apm(void *unused)
1776 printk("unknown\n"); 1795 printk("unknown\n");
1777 else 1796 else
1778 printk("%d %s\n", dx & 0x7fff, 1797 printk("%d %s\n", dx & 0x7fff,
1779 (dx & 0x8000) ? 1798 (dx & 0x8000) ?
1780 "minutes" : "seconds"); 1799 "minutes" : "seconds");
1781 } 1800 }
1782 } 1801 }
1783 } 1802 }
@@ -1802,7 +1821,7 @@ static int apm(void *unused)
1802#ifndef MODULE 1821#ifndef MODULE
1803static int __init apm_setup(char *str) 1822static int __init apm_setup(char *str)
1804{ 1823{
1805 int invert; 1824 int invert;
1806 1825
1807 while ((str != NULL) && (*str != '\0')) { 1826 while ((str != NULL) && (*str != '\0')) {
1808 if (strncmp(str, "off", 3) == 0) 1827 if (strncmp(str, "off", 3) == 0)
@@ -1827,14 +1846,13 @@ static int __init apm_setup(char *str)
1827 if ((strncmp(str, "power-off", 9) == 0) || 1846 if ((strncmp(str, "power-off", 9) == 0) ||
1828 (strncmp(str, "power_off", 9) == 0)) 1847 (strncmp(str, "power_off", 9) == 0))
1829 power_off = !invert; 1848 power_off = !invert;
1830 if (strncmp(str, "smp", 3) == 0) 1849 if (strncmp(str, "smp", 3) == 0) {
1831 {
1832 smp = !invert; 1850 smp = !invert;
1833 idle_threshold = 100; 1851 idle_threshold = 100;
1834 } 1852 }
1835 if ((strncmp(str, "allow-ints", 10) == 0) || 1853 if ((strncmp(str, "allow-ints", 10) == 0) ||
1836 (strncmp(str, "allow_ints", 10) == 0)) 1854 (strncmp(str, "allow_ints", 10) == 0))
1837 apm_info.allow_ints = !invert; 1855 apm_info.allow_ints = !invert;
1838 if ((strncmp(str, "broken-psr", 10) == 0) || 1856 if ((strncmp(str, "broken-psr", 10) == 0) ||
1839 (strncmp(str, "broken_psr", 10) == 0)) 1857 (strncmp(str, "broken_psr", 10) == 0))
1840 apm_info.get_power_status_broken = !invert; 1858 apm_info.get_power_status_broken = !invert;
@@ -1880,7 +1898,8 @@ static int __init print_if_true(const struct dmi_system_id *d)
1880 */ 1898 */
1881static int __init broken_ps2_resume(const struct dmi_system_id *d) 1899static int __init broken_ps2_resume(const struct dmi_system_id *d)
1882{ 1900{
1883 printk(KERN_INFO "%s machine detected. Mousepad Resume Bug workaround hopefully not needed.\n", d->ident); 1901 printk(KERN_INFO "%s machine detected. Mousepad Resume Bug "
1902 "workaround hopefully not needed.\n", d->ident);
1884 return 0; 1903 return 0;
1885} 1904}
1886 1905
@@ -1889,7 +1908,8 @@ static int __init set_realmode_power_off(const struct dmi_system_id *d)
1889{ 1908{
1890 if (apm_info.realmode_power_off == 0) { 1909 if (apm_info.realmode_power_off == 0) {
1891 apm_info.realmode_power_off = 1; 1910 apm_info.realmode_power_off = 1;
1892 printk(KERN_INFO "%s bios detected. Using realmode poweroff only.\n", d->ident); 1911 printk(KERN_INFO "%s bios detected. "
1912 "Using realmode poweroff only.\n", d->ident);
1893 } 1913 }
1894 return 0; 1914 return 0;
1895} 1915}
@@ -1899,7 +1919,8 @@ static int __init set_apm_ints(const struct dmi_system_id *d)
1899{ 1919{
1900 if (apm_info.allow_ints == 0) { 1920 if (apm_info.allow_ints == 0) {
1901 apm_info.allow_ints = 1; 1921 apm_info.allow_ints = 1;
1902 printk(KERN_INFO "%s machine detected. Enabling interrupts during APM calls.\n", d->ident); 1922 printk(KERN_INFO "%s machine detected. "
1923 "Enabling interrupts during APM calls.\n", d->ident);
1903 } 1924 }
1904 return 0; 1925 return 0;
1905} 1926}
@@ -1909,7 +1930,8 @@ static int __init apm_is_horked(const struct dmi_system_id *d)
1909{ 1930{
1910 if (apm_info.disabled == 0) { 1931 if (apm_info.disabled == 0) {
1911 apm_info.disabled = 1; 1932 apm_info.disabled = 1;
1912 printk(KERN_INFO "%s machine detected. Disabling APM.\n", d->ident); 1933 printk(KERN_INFO "%s machine detected. "
1934 "Disabling APM.\n", d->ident);
1913 } 1935 }
1914 return 0; 1936 return 0;
1915} 1937}
@@ -1918,7 +1940,8 @@ static int __init apm_is_horked_d850md(const struct dmi_system_id *d)
1918{ 1940{
1919 if (apm_info.disabled == 0) { 1941 if (apm_info.disabled == 0) {
1920 apm_info.disabled = 1; 1942 apm_info.disabled = 1;
1921 printk(KERN_INFO "%s machine detected. Disabling APM.\n", d->ident); 1943 printk(KERN_INFO "%s machine detected. "
1944 "Disabling APM.\n", d->ident);
1922 printk(KERN_INFO "This bug is fixed in bios P15 which is available for \n"); 1945 printk(KERN_INFO "This bug is fixed in bios P15 which is available for \n");
1923 printk(KERN_INFO "download from support.intel.com \n"); 1946 printk(KERN_INFO "download from support.intel.com \n");
1924 } 1947 }
@@ -1930,7 +1953,8 @@ static int __init apm_likes_to_melt(const struct dmi_system_id *d)
1930{ 1953{
1931 if (apm_info.forbid_idle == 0) { 1954 if (apm_info.forbid_idle == 0) {
1932 apm_info.forbid_idle = 1; 1955 apm_info.forbid_idle = 1;
1933 printk(KERN_INFO "%s machine detected. Disabling APM idle calls.\n", d->ident); 1956 printk(KERN_INFO "%s machine detected. "
1957 "Disabling APM idle calls.\n", d->ident);
1934 } 1958 }
1935 return 0; 1959 return 0;
1936} 1960}
@@ -1953,7 +1977,8 @@ static int __init apm_likes_to_melt(const struct dmi_system_id *d)
1953static int __init broken_apm_power(const struct dmi_system_id *d) 1977static int __init broken_apm_power(const struct dmi_system_id *d)
1954{ 1978{
1955 apm_info.get_power_status_broken = 1; 1979 apm_info.get_power_status_broken = 1;
1956 printk(KERN_WARNING "BIOS strings suggest APM bugs, disabling power status reporting.\n"); 1980 printk(KERN_WARNING "BIOS strings suggest APM bugs, "
1981 "disabling power status reporting.\n");
1957 return 0; 1982 return 0;
1958} 1983}
1959 1984
@@ -1964,7 +1989,8 @@ static int __init broken_apm_power(const struct dmi_system_id *d)
1964static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d) 1989static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d)
1965{ 1990{
1966 apm_info.get_power_status_swabinminutes = 1; 1991 apm_info.get_power_status_swabinminutes = 1;
1967 printk(KERN_WARNING "BIOS strings suggest APM reports battery life in minutes and wrong byte order.\n"); 1992 printk(KERN_WARNING "BIOS strings suggest APM reports battery life "
1993 "in minutes and wrong byte order.\n");
1968 return 0; 1994 return 0;
1969} 1995}
1970 1996
@@ -1989,8 +2015,8 @@ static struct dmi_system_id __initdata apm_dmi_table[] = {
1989 apm_is_horked, "Dell Inspiron 2500", 2015 apm_is_horked, "Dell Inspiron 2500",
1990 { DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 2016 { DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
1991 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 2500"), 2017 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 2500"),
1992 DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), 2018 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
1993 DMI_MATCH(DMI_BIOS_VERSION,"A11"), }, 2019 DMI_MATCH(DMI_BIOS_VERSION, "A11"), },
1994 }, 2020 },
1995 { /* Allow interrupts during suspend on Dell Inspiron laptops*/ 2021 { /* Allow interrupts during suspend on Dell Inspiron laptops*/
1996 set_apm_ints, "Dell Inspiron", { 2022 set_apm_ints, "Dell Inspiron", {
@@ -2013,15 +2039,15 @@ static struct dmi_system_id __initdata apm_dmi_table[] = {
2013 apm_is_horked, "Dell Dimension 4100", 2039 apm_is_horked, "Dell Dimension 4100",
2014 { DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 2040 { DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
2015 DMI_MATCH(DMI_PRODUCT_NAME, "XPS-Z"), 2041 DMI_MATCH(DMI_PRODUCT_NAME, "XPS-Z"),
2016 DMI_MATCH(DMI_BIOS_VENDOR,"Intel Corp."), 2042 DMI_MATCH(DMI_BIOS_VENDOR, "Intel Corp."),
2017 DMI_MATCH(DMI_BIOS_VERSION,"A11"), }, 2043 DMI_MATCH(DMI_BIOS_VERSION, "A11"), },
2018 }, 2044 },
2019 { /* Allow interrupts during suspend on Compaq Laptops*/ 2045 { /* Allow interrupts during suspend on Compaq Laptops*/
2020 set_apm_ints, "Compaq 12XL125", 2046 set_apm_ints, "Compaq 12XL125",
2021 { DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), 2047 { DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
2022 DMI_MATCH(DMI_PRODUCT_NAME, "Compaq PC"), 2048 DMI_MATCH(DMI_PRODUCT_NAME, "Compaq PC"),
2023 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), 2049 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
2024 DMI_MATCH(DMI_BIOS_VERSION,"4.06"), }, 2050 DMI_MATCH(DMI_BIOS_VERSION, "4.06"), },
2025 }, 2051 },
2026 { /* Allow interrupts during APM or the clock goes slow */ 2052 { /* Allow interrupts during APM or the clock goes slow */
2027 set_apm_ints, "ASUSTeK", 2053 set_apm_ints, "ASUSTeK",
@@ -2063,15 +2089,15 @@ static struct dmi_system_id __initdata apm_dmi_table[] = {
2063 apm_is_horked, "Sharp PC-PJ/AX", 2089 apm_is_horked, "Sharp PC-PJ/AX",
2064 { DMI_MATCH(DMI_SYS_VENDOR, "SHARP"), 2090 { DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
2065 DMI_MATCH(DMI_PRODUCT_NAME, "PC-PJ/AX"), 2091 DMI_MATCH(DMI_PRODUCT_NAME, "PC-PJ/AX"),
2066 DMI_MATCH(DMI_BIOS_VENDOR,"SystemSoft"), 2092 DMI_MATCH(DMI_BIOS_VENDOR, "SystemSoft"),
2067 DMI_MATCH(DMI_BIOS_VERSION,"Version R2.08"), }, 2093 DMI_MATCH(DMI_BIOS_VERSION, "Version R2.08"), },
2068 }, 2094 },
2069 { /* APM crashes */ 2095 { /* APM crashes */
2070 apm_is_horked, "Dell Inspiron 2500", 2096 apm_is_horked, "Dell Inspiron 2500",
2071 { DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 2097 { DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
2072 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 2500"), 2098 DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 2500"),
2073 DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), 2099 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
2074 DMI_MATCH(DMI_BIOS_VERSION,"A11"), }, 2100 DMI_MATCH(DMI_BIOS_VERSION, "A11"), },
2075 }, 2101 },
2076 { /* APM idle hangs */ 2102 { /* APM idle hangs */
2077 apm_likes_to_melt, "Jabil AMD", 2103 apm_likes_to_melt, "Jabil AMD",
@@ -2202,11 +2228,11 @@ static int __init apm_init(void)
2202 return -ENODEV; 2228 return -ENODEV;
2203 } 2229 }
2204 printk(KERN_INFO 2230 printk(KERN_INFO
2205 "apm: BIOS version %d.%d Flags 0x%02x (Driver version %s)\n", 2231 "apm: BIOS version %d.%d Flags 0x%02x (Driver version %s)\n",
2206 ((apm_info.bios.version >> 8) & 0xff), 2232 ((apm_info.bios.version >> 8) & 0xff),
2207 (apm_info.bios.version & 0xff), 2233 (apm_info.bios.version & 0xff),
2208 apm_info.bios.flags, 2234 apm_info.bios.flags,
2209 driver_version); 2235 driver_version);
2210 if ((apm_info.bios.flags & APM_32_BIT_SUPPORT) == 0) { 2236 if ((apm_info.bios.flags & APM_32_BIT_SUPPORT) == 0) {
2211 printk(KERN_INFO "apm: no 32 bit BIOS support\n"); 2237 printk(KERN_INFO "apm: no 32 bit BIOS support\n");
2212 return -ENODEV; 2238 return -ENODEV;
@@ -2311,9 +2337,9 @@ static int __init apm_init(void)
2311 } 2337 }
2312 wake_up_process(kapmd_task); 2338 wake_up_process(kapmd_task);
2313 2339
2314 if (num_online_cpus() > 1 && !smp ) { 2340 if (num_online_cpus() > 1 && !smp) {
2315 printk(KERN_NOTICE 2341 printk(KERN_NOTICE
2316 "apm: disabled - APM is not SMP safe (power off active).\n"); 2342 "apm: disabled - APM is not SMP safe (power off active).\n");
2317 return 0; 2343 return 0;
2318 } 2344 }
2319 2345
@@ -2338,7 +2364,7 @@ static int __init apm_init(void)
2338 2364
2339static void __exit apm_exit(void) 2365static void __exit apm_exit(void)
2340{ 2366{
2341 int error; 2367 int error;
2342 2368
2343 if (set_pm_idle) { 2369 if (set_pm_idle) {
2344 pm_idle = original_pm_idle; 2370 pm_idle = original_pm_idle;