-/* $OpenBSD: ucom.c,v 1.63 2014/02/03 20:59:05 mpi Exp $ */
+/* $OpenBSD: ucom.c,v 1.64 2014/05/06 09:44:31 mpi Exp $ */
/* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */
/*
sc->sc_bulkout_pipe = NULL;
}
if (sc->sc_ixfer != NULL) {
- if (sc->sc_uhidev == NULL)
+ if (sc->sc_bulkin_no != -1) {
+ usbd_free_buffer(sc->sc_ixfer);
+ sc->sc_ibuf = NULL;
usbd_free_xfer(sc->sc_ixfer);
+ }
sc->sc_ixfer = NULL;
}
if (sc->sc_oxfer != NULL) {
usbd_free_buffer(sc->sc_oxfer);
- if (sc->sc_uhidev == NULL)
+ sc->sc_obuf = NULL;
+ if (sc->sc_bulkin_no != -1)
usbd_free_xfer(sc->sc_oxfer);
sc->sc_oxfer = NULL;
}
tp = sc->sc_tty;
splx(s);
- DPRINTF(("ucomopen: unit=%d, tp=%p\n", unit, tp));
+ DPRINTF(("ucomopen: unit=%d, tp=%p\n", UCOMUNIT(dev), tp));
tp->t_dev = dev;
if (!ISSET(tp->t_state, TS_ISOPEN)) {
return (0);
fail_4:
- if (sc->sc_uhidev == NULL)
+ if (sc->sc_bulkin_no != -1)
usbd_free_xfer(sc->sc_oxfer);
sc->sc_oxfer = NULL;
fail_3:
if (sc == NULL || usbd_is_dying(sc->sc_uparent))
return (EIO);
+ DPRINTF(("ucomclose: unit=%d\n", UCOMUNIT(dev)));
+
sc->sc_refcnt++;
error = ucom_do_close(sc, flag, mode, p);
if (--sc->sc_refcnt < 0)
if (!ISSET(tp->t_state, TS_ISOPEN))
return (0);
- DPRINTF(("ucomclose: unit=%d\n", UCOMUNIT(dev)));
ucom_lock(sc);
(*LINESW(tp, l_close))(tp, flag, p);
sc->sc_bulkout_pipe = NULL;
}
if (sc->sc_ixfer != NULL) {
- if (sc->sc_uhidev == NULL)
+ if (sc->sc_bulkin_no != -1) {
+ usbd_free_buffer(sc->sc_ixfer);
+ sc->sc_ibuf = NULL;
usbd_free_xfer(sc->sc_ixfer);
+ }
sc->sc_ixfer = NULL;
}
if (sc->sc_oxfer != NULL) {
usbd_free_buffer(sc->sc_oxfer);
- if (sc->sc_uhidev == NULL)
+ sc->sc_obuf = NULL;
+ if (sc->sc_bulkin_no != -1)
usbd_free_xfer(sc->sc_oxfer);
sc->sc_oxfer = NULL;
}