Date: Thu, 6 Oct 2022 11:54:38 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 9e0edafe92ad - main - uslcom(4): Clear stall at every open. Message-ID: <202210061154.296Bsc41093436@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9e0edafe92ad9fc6745ee4c4c58e45a49b9e7ed1 commit 9e0edafe92ad9fc6745ee4c4c58e45a49b9e7ed1 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-10-05 14:45:21 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-10-06 11:54:02 +0000 uslcom(4): Clear stall at every open. To avoid data loss, make sure both the receive and transmit data toggles get reset, before trying to read or write any data. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/usb/serial/uslcom.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/dev/usb/serial/uslcom.c b/sys/dev/usb/serial/uslcom.c index e4367d6781a7..868711afef01 100644 --- a/sys/dev/usb/serial/uslcom.c +++ b/sys/dev/usb/serial/uslcom.c @@ -439,12 +439,6 @@ uslcom_attach(device_t dev) "error=%s\n", usbd_errstr(error)); goto detach; } - /* clear stall at first run */ - mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_WR]); - usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]); - mtx_unlock(&sc->sc_mtx); - sc->sc_partnum = uslcom_get_partnum(sc); error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -514,6 +508,10 @@ uslcom_cfg_open(struct ucom_softc *ucom) DPRINTF("UART enable failed (ignored)\n"); } + /* clear stall */ + usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_WR]); + usbd_xfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]); + /* start polling status */ uslcom_watchdog(sc); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202210061154.296Bsc41093436>