From owner-svn-src-head@FreeBSD.ORG Tue May 26 17:06:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33E2710656A3; Tue, 26 May 2009 17:06:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 178BD8FC08; Tue, 26 May 2009 17:06:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QH6acR066345; Tue, 26 May 2009 17:06:36 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QH6aAp066343; Tue, 26 May 2009 17:06:36 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905261706.n4QH6aAp066343@svn.freebsd.org> From: Andrew Thompson Date: Tue, 26 May 2009 17:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192820 - head/sys/dev/usb/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 17:06:37 -0000 Author: thompsa Date: Tue May 26 17:06:36 2009 New Revision: 192820 URL: http://svn.freebsd.org/changeset/base/192820 Log: Do not forcefully close the write transfer when closing the tty, it needs to run to completion and drain the tty queue. Modified: head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/usb_serial.h Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Tue May 26 17:01:12 2009 (r192819) +++ head/sys/dev/usb/serial/usb_serial.c Tue May 26 17:06:36 2009 (r192820) @@ -589,13 +589,9 @@ usb2_com_cfg_close(struct usb2_proc_msg 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 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 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 */ Modified: head/sys/dev/usb/serial/usb_serial.h ============================================================================== --- head/sys/dev/usb/serial/usb_serial.h Tue May 26 17:01:12 2009 (r192819) +++ head/sys/dev/usb/serial/usb_serial.h Tue May 26 17:06:36 2009 (r192820) @@ -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;