From ddb81f81c6b53bdfc4bba2ced060724d2beb0270 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Thu, 13 Mar 2014 03:52:57 +0000 Subject: 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. --- sys/arch/arm/xscale/pxa2x0_apm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sys/arch/arm/xscale/pxa2x0_apm.c') diff --git a/sys/arch/arm/xscale/pxa2x0_apm.c b/sys/arch/arm/xscale/pxa2x0_apm.c index 8f55ff95b54..7d4a97388a3 100644 --- a/sys/arch/arm/xscale/pxa2x0_apm.c +++ b/sys/arch/arm/xscale/pxa2x0_apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_apm.c,v 1.41 2013/12/06 21:03:05 deraadt Exp $ */ +/* $OpenBSD: pxa2x0_apm.c,v 1.42 2014/03/13 03:52:55 dlg Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -306,6 +306,7 @@ apm_power_info(struct pxa2x0_apm_softc *sc, void apm_suspend(struct pxa2x0_apm_softc *sc) { + struct device *mainbus = device_mainbus(); int s; #if NWSDISPLAY > 0 @@ -320,14 +321,14 @@ apm_suspend(struct pxa2x0_apm_softc *sc) sc->sc_suspend(sc); s = splhigh(); - config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND); + config_suspend(mainbus, DVACT_SUSPEND); /* XXX * Flag to disk drivers that they should "power down" the disk * when we get to DVACT_POWERDOWN. */ boothowto |= RB_POWERDOWN; - config_suspend(TAILQ_FIRST(&alldevs), DVACT_POWERDOWN); + config_suspend(mainbus, DVACT_POWERDOWN); boothowto &= ~RB_POWERDOWN; splx(s); @@ -338,10 +339,11 @@ apm_suspend(struct pxa2x0_apm_softc *sc) void apm_resume(struct pxa2x0_apm_softc *sc) { + struct device *mainbus = device_mainbus(); int s; s = splhigh(); - config_suspend(TAILQ_FIRST(&alldevs), DVACT_RESUME); + config_suspend(mainbus, DVACT_RESUME); splx(s); inittodr(0); @@ -355,7 +357,7 @@ apm_resume(struct pxa2x0_apm_softc *sc) bufq_restart(); - config_suspend(TAILQ_FIRST(&alldevs), DVACT_WAKEUP); + config_suspend(mainbus, DVACT_WAKEUP); #if NWSDISPLAY > 0 wsdisplay_resume(); -- cgit v1.2.3