summaryrefslogtreecommitdiff
path: root/sys/arch/loongson/dev/apm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/loongson/dev/apm.c')
-rw-r--r--sys/arch/loongson/dev/apm.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/arch/loongson/dev/apm.c b/sys/arch/loongson/dev/apm.c
index d85c32cd520..7ffc588d9ce 100644
--- a/sys/arch/loongson/dev/apm.c
+++ b/sys/arch/loongson/dev/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.17 2013/12/06 21:03:05 deraadt Exp $ */
+/* $OpenBSD: apm.c,v 1.18 2014/03/13 03:52:55 dlg Exp $ */
/*-
* Copyright (c) 2001 Alexander Guy. All rights reserved.
@@ -360,6 +360,7 @@ apm_record_event(u_int event, const char *src, const char *msg)
int
apm_suspend(int state)
{
+ struct device *mainbus = device_mainbus();
int rv;
int s;
@@ -370,13 +371,13 @@ apm_suspend(int state)
resettodr();
bufq_quiesce();
- config_suspend(TAILQ_FIRST(&alldevs), DVACT_QUIESCE);
+ config_suspend(mainbus, DVACT_QUIESCE);
s = splhigh();
(void)disableintr();
cold = 1;
- rv = config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND);
+ rv = config_suspend(mainbus, DVACT_SUSPEND);
#ifdef HIBERNATE
if (state == APM_IOC_HIBERNATE) {
@@ -395,7 +396,7 @@ apm_suspend(int state)
* when we get to DVACT_POWERDOWN.
*/
boothowto |= RB_POWERDOWN;
- (void) config_suspend(TAILQ_FIRST(&alldevs), DVACT_POWERDOWN);
+ (void) config_suspend(mainbus, DVACT_POWERDOWN);
boothowto &= ~RB_POWERDOWN;
if (rv == 0) {
@@ -404,7 +405,7 @@ apm_suspend(int state)
rv = sys_platform->resume();
}
inittodr(time_second); /* Move the clock forward */
- config_suspend(TAILQ_FIRST(&alldevs), DVACT_RESUME);
+ config_suspend(mainbus, DVACT_RESUME);
cold = 0;
(void)enableintr();
@@ -412,7 +413,7 @@ apm_suspend(int state)
bufq_restart();
- config_suspend(TAILQ_FIRST(&alldevs), DVACT_WAKEUP);
+ config_suspend(mainbus, DVACT_WAKEUP);
#if NWSDISPLAY > 0
wsdisplay_resume();