diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-05-26 17:06:36 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-05-26 17:06:36 +0000 |
commit | daa6d3326cb1bdd44a704a001a27f860dca032ca (patch) | |
tree | 01c4dd553e54b9dce5450928b9dc84543c077c90 | |
parent | a08e1f64b1b570a93e8eb5a834e3e1980c1f459d (diff) | |
download | FreeBSD-src-daa6d3326cb1bdd44a704a001a27f860dca032ca.zip FreeBSD-src-daa6d3326cb1bdd44a704a001a27f860dca032ca.tar.gz |
Do not forcefully close the write transfer when closing the tty, it needs to
run to completion and drain the tty queue.
-rw-r--r-- | sys/dev/usb/serial/usb_serial.c | 27 | ||||
-rw-r--r-- | sys/dev/usb/serial/usb_serial.h | 1 |
2 files changed, 7 insertions, 21 deletions
diff --git a/sys/dev/usb/serial/usb_serial.c b/sys/dev/usb/serial/usb_serial.c index 23d61f2..99ec4d6 100644 --- a/sys/dev/usb/serial/usb_serial.c +++ b/sys/dev/usb/serial/usb_serial.c @@ -589,13 +589,9 @@ usb2_com_cfg_close(struct usb2_proc_msg *_task) DPRINTF("\n"); if (sc->sc_flag & UCOM_FLAG_LL_READY) { - - sc->sc_flag &= ~(UCOM_FLAG_LL_READY | - UCOM_FLAG_GP_DATA); - - if (sc->sc_callback->usb2_com_cfg_close) { + sc->sc_flag &= ~UCOM_FLAG_LL_READY; + if (sc->sc_callback->usb2_com_cfg_close) (sc->sc_callback->usb2_com_cfg_close) (sc); - } } else { /* already closed */ } @@ -620,16 +616,11 @@ usb2_com_close(struct tty *tp) &sc->sc_close_task[0].hdr, &sc->sc_close_task[1].hdr); - sc->sc_flag &= ~(UCOM_FLAG_HL_READY | - UCOM_FLAG_WR_START | - UCOM_FLAG_RTS_IFLOW); + sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_RTS_IFLOW); if (sc->sc_callback->usb2_com_stop_read) { (sc->sc_callback->usb2_com_stop_read) (sc); } - if (sc->sc_callback->usb2_com_stop_write) { - (sc->sc_callback->usb2_com_stop_write) (sc); - } } static int @@ -1005,8 +996,6 @@ usb2_com_outwakeup(struct tty *tp) /* The higher layer is not ready */ return; } - sc->sc_flag |= UCOM_FLAG_WR_START; - usb2_com_start_transfers(sc); } @@ -1028,9 +1017,8 @@ usb2_com_get_data(struct usb2_com_softc *sc, struct usb2_page_cache *pc, mtx_assert(sc->sc_mtx, MA_OWNED); - if ((!(sc->sc_flag & UCOM_FLAG_HL_READY)) || - (!(sc->sc_flag & UCOM_FLAG_GP_DATA)) || - (!(sc->sc_flag & UCOM_FLAG_WR_START))) { + if (tty_gone(tp) || + !(sc->sc_flag & UCOM_FLAG_GP_DATA)) { actlen[0] = 0; return (0); /* multiport device polling */ } @@ -1076,10 +1064,9 @@ usb2_com_put_data(struct usb2_com_softc *sc, struct usb2_page_cache *pc, mtx_assert(sc->sc_mtx, MA_OWNED); - if ((!(sc->sc_flag & UCOM_FLAG_HL_READY)) || - (!(sc->sc_flag & UCOM_FLAG_GP_DATA))) { + if (tty_gone(tp)) return; /* multiport device polling */ - } + if (len == 0) return; /* no data */ diff --git a/sys/dev/usb/serial/usb_serial.h b/sys/dev/usb/serial/usb_serial.h index 7b5837a..ddbb65b 100644 --- a/sys/dev/usb/serial/usb_serial.h +++ b/sys/dev/usb/serial/usb_serial.h @@ -167,7 +167,6 @@ struct usb2_com_softc { #define UCOM_FLAG_GONE 0x02 /* the device is gone */ #define UCOM_FLAG_ATTACHED 0x04 /* set if attached */ #define UCOM_FLAG_GP_DATA 0x08 /* set if get and put data is possible */ -#define UCOM_FLAG_WR_START 0x10 /* set if write start was issued */ #define UCOM_FLAG_LL_READY 0x20 /* set if low layer is ready */ #define UCOM_FLAG_HL_READY 0x40 /* set if high layer is ready */ uint8_t sc_lsr; |