diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2014-03-13 03:52:57 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2014-03-13 03:52:57 +0000 |
commit | ddb81f81c6b53bdfc4bba2ced060724d2beb0270 (patch) | |
tree | 84af82316dccb1276e4f2db46dffa3136279a846 /sys/arch/loongson/dev | |
parent | 755327f10676720e29b6c5b380070fbdca133628 (diff) |
get rid of the assumption that the head of the alldevs list is the
"mainbus" device. this breaks when mpath is enabled because it
attaches before mainbus and therefore takes the head position.
have autoconf provide device_mainbus() which looks up mainbus_cd,
and use that instead.
discussed with deraadt who just wants mpath stuff to move forward
despite there being many ways to shine this particular turd.
Diffstat (limited to 'sys/arch/loongson/dev')
-rw-r--r-- | sys/arch/loongson/dev/apm.c | 13 |
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(); |