From ec76778bae590cc6a4cf85e411ed98cbaa49d5ea Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 8 May 2007 21:18:19 +0000 Subject: move com_activate() to where it belongs --- sys/dev/cardbus/com_cardbus.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'sys/dev/cardbus') diff --git a/sys/dev/cardbus/com_cardbus.c b/sys/dev/cardbus/com_cardbus.c index fb3b1ad3a2e..af7eda1b341 100644 --- a/sys/dev/cardbus/com_cardbus.c +++ b/sys/dev/cardbus/com_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_cardbus.c,v 1.28 2007/05/08 20:43:07 deraadt Exp $ */ +/* $OpenBSD: com_cardbus.c,v 1.29 2007/05/08 21:18:18 deraadt Exp $ */ /* $NetBSD: com_cardbus.c,v 1.4 2000/04/17 09:21:59 joda Exp $ */ /* @@ -115,6 +115,10 @@ struct csdev *com_cardbus_find_csdev(struct cardbus_attach_args *); int com_cardbus_gofigure(struct cardbus_attach_args *, struct com_cardbus_softc *); +int com_activate(struct device *, enum devact); +int com_detach(struct device *, int); +int comopen(dev_t dev, int flag, int mode, struct proc *p); + #if NCOM_CARDBUS struct cfattach com_cardbus_ca = { sizeof(struct com_cardbus_softc), com_cardbus_match, @@ -386,9 +390,6 @@ com_cardbus_disable(struct com_softc *sc) Cardbus_function_disable(csc->cc_ct); } -int com_detach(struct device *, int); -int comopen(dev_t dev, int flag, int mode, struct proc *p); - int com_detach(self, flags) struct device *self; @@ -428,6 +429,39 @@ com_detach(self, flags) return (0); } +int +com_activate(self, act) + struct device *self; + enum devact act; +{ + struct com_softc *sc = (struct com_softc *)self; + int s, rv = 0; + + s = spltty(); + switch (act) { + case DVACT_ACTIVATE: + break; + + case DVACT_DEACTIVATE: +#ifdef KGDB + if (sc->sc_hwflags & (COM_HW_CONSOLE|COM_HW_KGDB)) { +#else + if (sc->sc_hwflags & COM_HW_CONSOLE) { +#endif /* KGDB */ + rv = EBUSY; + break; + } + + if (sc->disable != NULL && sc->enabled != 0) { + (*sc->disable)(sc); + sc->enabled = 0; + } + break; + } + splx(s); + return (rv); +} + int com_cardbus_detach(struct device *self, int flags) { -- cgit v1.2.3