Date: Sun, 2 Dec 2007 14:57:05 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 130019 for review Message-ID: <200712021457.lB2Ev5rv092822@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=130019 Change 130019 by hselasky@hselasky_laptop001 on 2007/12/02 14:56:17 UCOM cannot use "usbd_get_page()". Use "usbd_get_buffer()" instead. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/ucom.c#24 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/ucom.c#24 (text+ko) ==== @@ -1023,10 +1023,8 @@ ucom_get_data(struct ucom_softc *sc, struct usbd_page_cache *pc, uint32_t offset, uint32_t len, uint32_t *actlen) { - struct usbd_page_search res; struct tty *tp = sc->sc_tty; uint32_t cnt; - uint32_t offset_orig; mtx_assert(sc->sc_parent_mtx, MA_OWNED); @@ -1056,28 +1054,11 @@ DPRINTF(0, "stopped\n"); goto done; } - offset_orig = offset; - while (len > 0) { + cnt = q_to_b(&(tp->t_outq), usbd_get_buffer(pc,offset), len); - usbd_get_page(pc, offset, &res); - - if (res.length > len) { - res.length = len; - } - cnt = q_to_b(&(tp->t_outq), res.buffer, res.length); + actlen[0] = cnt; - offset += cnt; - len -= cnt; - - if (cnt < res.length) { - /* end of buffer */ - break; - } - } - - actlen[0] = offset - offset_orig; - DPRINTF(0, "cnt=%d\n", actlen[0]); if (actlen[0] == 0) { @@ -1099,8 +1080,8 @@ ucom_put_data(struct ucom_softc *sc, struct usbd_page_cache *pc, uint32_t offset, uint32_t len) { - struct usbd_page_search res; struct tty *tp = sc->sc_tty; + uint8_t *buf; uint32_t cnt; mtx_assert(sc->sc_parent_mtx, MA_OWNED); @@ -1111,27 +1092,19 @@ } /* set a flag to prevent recursation ? */ - while (len > 0) { - - usbd_get_page(pc, offset, &res); - - if (res.length > len) { - res.length = len; - } - len -= res.length; - offset += res.length; + buf = usbd_get_buffer(pc, offset); if (tp->t_state & TS_CAN_BYPASS_L_RINT) { - if (((tp->t_rawq.c_cc + res.length) > tp->t_ihiwat) && + if (((tp->t_rawq.c_cc + len) > tp->t_ihiwat) && ((sc->sc_flag & UCOM_FLAG_RTS_IFLOW) || (tp->t_iflag & IXOFF)) && (!(tp->t_state & TS_TBLOCK))) { ttyblock(tp); } - cnt = b_to_q(res.buffer, res.length, &(tp->t_rawq)); + cnt = b_to_q(buf, len, &(tp->t_rawq)); - tp->t_rawcc += res.length; + tp->t_rawcc += len; ttwakeup(tp); @@ -1150,19 +1123,18 @@ /* pass characters to tty layer */ - for (cnt = 0; cnt < res.length; cnt++) { + for (cnt = 0; cnt != len; cnt++) { - if (ttyld_rint(tp, ((uint8_t *)res.buffer)[cnt]) == -1) { + if (ttyld_rint(tp, buf[cnt]) == -1) { /* XXX what should we do? */ DPRINTF(0, "tp=%p, lost %d " - "chars\n", tp, res.length - cnt); + "chars\n", tp, len - cnt); break; } } } - } if ((sc->sc_flag & UCOM_FLAG_RTS_IFLOW) && (!(sc->sc_mcr & SER_RTS)) &&
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712021457.lB2Ev5rv092822>