summaryrefslogtreecommitdiff
path: root/sys/dev/usb/serial/ufoma.c
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2012-08-15 15:42:57 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2012-08-15 15:42:57 +0000
commitc01fc06ee950fbff6eb2c20b98023c408821304b (patch)
tree99fdc32e57fe511a68b57a70585fea2b615a844d /sys/dev/usb/serial/ufoma.c
parent84e1a128d1172b0b5717a2caa59a015da335fe78 (diff)
Notes
Diffstat (limited to 'sys/dev/usb/serial/ufoma.c')
-rw-r--r--sys/dev/usb/serial/ufoma.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/usb/serial/ufoma.c b/sys/dev/usb/serial/ufoma.c
index 0e9adf5172975..d929f8630ef00 100644
--- a/sys/dev/usb/serial/ufoma.c
+++ b/sys/dev/usb/serial/ufoma.c
@@ -202,7 +202,7 @@ struct ufoma_softc {
static device_probe_t ufoma_probe;
static device_attach_t ufoma_attach;
static device_detach_t ufoma_detach;
-static device_free_softc_t ufoma_free_softc;
+static void ufoma_free_softc(struct ufoma_softc *);
static usb_callback_t ufoma_ctrl_read_callback;
static usb_callback_t ufoma_ctrl_write_callback;
@@ -313,7 +313,6 @@ static device_method_t ufoma_methods[] = {
DEVMETHOD(device_probe, ufoma_probe),
DEVMETHOD(device_attach, ufoma_attach),
DEVMETHOD(device_detach, ufoma_detach),
- DEVMETHOD(device_free_softc, ufoma_free_softc),
DEVMETHOD_END
};
@@ -498,27 +497,28 @@ ufoma_detach(device_t dev)
}
cv_destroy(&sc->sc_cv);
+ device_claim_softc(dev);
+
+ ufoma_free_softc(sc);
+
return (0);
}
UCOM_UNLOAD_DRAIN(ufoma);
static void
-ufoma_free_softc(device_t dev, void *arg)
+ufoma_free_softc(struct ufoma_softc *sc)
{
- struct ufoma_softc *sc = arg;
-
if (ucom_unref(&sc->sc_super_ucom)) {
- if (mtx_initialized(&sc->sc_mtx))
- mtx_destroy(&sc->sc_mtx);
- device_free_softc(dev, sc);
+ mtx_destroy(&sc->sc_mtx);
+ device_free_softc(sc);
}
}
static void
ufoma_free(struct ucom_softc *ucom)
{
- ufoma_free_softc(NULL, ucom->sc_parent);
+ ufoma_free_softc(ucom->sc_parent);
}
static void *