diff options
Diffstat (limited to 'arch/i386/kernel/apm.c')
| -rw-r--r-- | arch/i386/kernel/apm.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index 86e80c551478..003548b8735f 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c | |||
| @@ -769,8 +769,26 @@ static int set_system_power_state(u_short state) | |||
| 769 | static int apm_do_idle(void) | 769 | static int apm_do_idle(void) |
| 770 | { | 770 | { |
| 771 | u32 eax; | 771 | u32 eax; |
| 772 | u8 ret = 0; | ||
| 773 | int idled = 0; | ||
| 774 | int polling; | ||
| 775 | |||
| 776 | polling = test_thread_flag(TIF_POLLING_NRFLAG); | ||
| 777 | if (polling) { | ||
| 778 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
| 779 | smp_mb__after_clear_bit(); | ||
| 780 | } | ||
| 781 | if (!need_resched()) { | ||
| 782 | idled = 1; | ||
| 783 | ret = apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax); | ||
| 784 | } | ||
| 785 | if (polling) | ||
| 786 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
| 787 | |||
| 788 | if (!idled) | ||
| 789 | return 0; | ||
| 772 | 790 | ||
| 773 | if (apm_bios_call_simple(APM_FUNC_IDLE, 0, 0, &eax)) { | 791 | if (ret) { |
| 774 | static unsigned long t; | 792 | static unsigned long t; |
| 775 | 793 | ||
| 776 | /* This always fails on some SMP boards running UP kernels. | 794 | /* This always fails on some SMP boards running UP kernels. |
