diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-30 21:30:18 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-30 21:30:18 +0000 |
commit | 8c5ca15652aa15c819bc19f9dfa8d692b19f2da2 (patch) | |
tree | e4687b2332b1b11d2e0a5324bb53618944e070d8 /sys/arch | |
parent | 0dc5c529ac587885468d2b11474fa9705127d678 (diff) |
Change powerhooks into activate functions, and provide stub powerhook
functions
ok kettenis
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_ohci.c | 42 | ||||
-rw-r--r-- | sys/arch/loongson/dev/ohci_voyager.c | 4 |
2 files changed, 26 insertions, 20 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_ohci.c b/sys/arch/arm/xscale/pxa2x0_ohci.c index 94b05953f83..1ca904c5bab 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.22 2010/08/27 05:04:06 deraadt Exp $ */ +/* $OpenBSD: pxa2x0_ohci.c,v 1.23 2010/08/30 21:30:15 deraadt Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -40,7 +40,8 @@ int pxaohci_match(struct device *, void *, void *); void pxaohci_attach(struct device *, struct device *, void *); int pxaohci_detach(struct device *, int); -void pxaohci_power(int, void *); +int pxaohci_activate(struct device *, int); +void pxaohci_powerhook(int, void *); struct pxaohci_softc { ohci_softc_t sc; @@ -126,7 +127,7 @@ unsupported: return; } - sc->sc.sc_powerhook = powerhook_establish(pxaohci_power, sc); + sc->sc.sc_powerhook = powerhook_establish(pxaohci_powerhook, sc); if (sc->sc.sc_powerhook == NULL) printf("%s: cannot establish powerhook\n", sc->sc.sc_bus.bdev.dv_xname); @@ -169,28 +170,33 @@ pxaohci_detach(struct device *self, int flags) } -void -pxaohci_power(int why, void *arg) +int +pxaohci_activate(struct device *self, int act) { - struct pxaohci_softc *sc = (struct pxaohci_softc *)arg; - int s; - - s = splhardusb(); - sc->sc.sc_bus.use_polling++; - switch (why) { - case PWR_SUSPEND: - ohci_power(why, &sc->sc); + struct pxaohci_softc *sc = (struct pxaohci_softc *)self; + + switch (act) { + case DVACT_SUSPEND: + sc->sc.sc_bus.use_polling++; + ohci_powerhook(act, &sc->sc); pxa2x0_clkman_config(CKEN_USBHC, 0); + sc->sc.sc_bus.use_polling--; break; - - case PWR_RESUME: + case DVACT_RESUME: + sc->sc.sc_bus.use_polling++; pxa2x0_clkman_config(CKEN_USBHC, 1); pxaohci_enable(sc); - ohci_power(why, &sc->sc); + ohci_powerhook(act, &sc->sc); + sc->sc.sc_bus.use_polling--; break; } - sc->sc.sc_bus.use_polling--; - splx(s); + return 0; +} + +void +pxaohci_powerhook(int why, void *arg) +{ + pxaohci_activate(arg, why); } void diff --git a/sys/arch/loongson/dev/ohci_voyager.c b/sys/arch/loongson/dev/ohci_voyager.c index ca37ca57503..9bac45f83cd 100644 --- a/sys/arch/loongson/dev/ohci_voyager.c +++ b/sys/arch/loongson/dev/ohci_voyager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ohci_voyager.c,v 1.1 2010/02/26 14:53:11 miod Exp $ */ +/* $OpenBSD: ohci_voyager.c,v 1.2 2010/08/30 21:30:17 deraadt Exp $ */ /* OpenBSD: ohci_pci.c,v 1.33 2008/06/26 05:42:17 ray Exp */ /* $NetBSD: ohci_pci.c,v 1.23 2002/10/02 16:51:47 thorpej Exp $ */ @@ -176,7 +176,7 @@ ohci_voyager_attach_deferred(struct device *self) return; } - sc->sc.sc_powerhook = powerhook_establish(ohci_power, &sc->sc); + sc->sc.sc_powerhook = powerhook_establish(ohci_powerhook, &sc->sc); if (sc->sc.sc_powerhook == NULL) printf("%s: unable to establish powerhook\n", sc->sc.sc_bus.bdev.dv_xname); |