summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruwe <uwe@openbsd.org>2005-04-03 23:47:36 +0000
committeruwe <uwe@openbsd.org>2005-04-03 23:47:36 +0000
commita2845663342841a82c04c778d13e0598053a468b (patch)
tree43d91c7b43eba05db4cbb2763460f0d254e6e38d
parentImplemente PT_[GS]ETXMMREGS ptrace(2) requests on i386. (diff)
downloadwireguard-openbsd-a2845663342841a82c04c778d13e0598053a468b.tar.xz
wireguard-openbsd-a2845663342841a82c04c778d13e0598053a468b.zip
check powerhook_establish() result, and pass the correct softc to it.
did not matter in this case because the softc's are aligned; ok dlg@
-rw-r--r--sys/arch/arm/xscale/pxa2x0_ohci.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_ohci.c b/sys/arch/arm/xscale/pxa2x0_ohci.c
index 2dcbccf6d1d..36bf5b68c4a 100644
--- a/sys/arch/arm/xscale/pxa2x0_ohci.c
+++ b/sys/arch/arm/xscale/pxa2x0_ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0_ohci.c,v 1.16 2005/03/30 14:40:47 dlg Exp $ */
+/* $OpenBSD: pxa2x0_ohci.c,v 1.17 2005/04/03 23:47:36 uwe Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -106,7 +106,10 @@ pxaohci_attach(struct device *parent, struct device *self, void *aux)
return;
}
- sc->sc.sc_powerhook = powerhook_establish(pxaohci_power, &sc->sc);
+ sc->sc.sc_powerhook = powerhook_establish(pxaohci_power, sc);
+ if (sc->sc.sc_powerhook == NULL)
+ printf("%s: can't establish power hook\n",
+ sc->sc.sc_bus.bdev.dv_xname);
sc->sc_ih = pxa2x0_intr_establish(PXA2X0_INT_USBH1, IPL_USB,
ohci_intr, sc, sc->sc.sc_bus.bdev.dv_xname);
@@ -125,7 +128,11 @@ pxaohci_detach(struct device *self, int flags)
rv = ohci_detach(&sc->sc, flags);
if (rv)
return (rv);
- powerhook_disestablish(sc->sc.sc_powerhook);
+
+ if (sc->sc.sc_powerhook != NULL) {
+ powerhook_disestablish(sc->sc.sc_powerhook);
+ sc->sc.sc_powerhook = NULL;
+ }
if (sc->sc_ih != NULL) {
pxa2x0_intr_disestablish(sc->sc_ih);
@@ -166,14 +173,14 @@ pxaohci_power(int why, void *arg)
switch (why) {
case PWR_STANDBY:
case PWR_SUSPEND:
- ohci_power(why, arg);
+ ohci_power(why, &sc->sc);
pxa2x0_clkman_config(CKEN_USBHC, 0);
break;
case PWR_RESUME:
pxa2x0_clkman_config(CKEN_USBHC, 1);
pxaohci_enable(sc);
- ohci_power(why, arg);
+ ohci_power(why, &sc->sc);
break;
}
sc->sc.sc_bus.use_polling--;
@@ -213,4 +220,3 @@ pxaohci_enable(struct pxaohci_softc *sc)
bus_space_write_4(sc->sc.iot, sc->sc.ioh, USBHC_HR,
(hr & USBHC_HR_MASK) & ~(USBHC_HR_SSEP2));
}
-