From nobody Thu Oct 06 11:54:38 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MjqcH0z1Sz4V25n; Thu, 6 Oct 2022 11:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MjqcH0Pv0z468b; Thu, 6 Oct 2022 11:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665057279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eZAY08oZy1LcB1CdlZm5wnfa68OKxIJJOL4Wr5ZtesA=; b=J6eAgkcZxzJdvdqcRlGx26+e54dh0IQRRy+bWLU9qGlZikPO/nrg4NKtbysOQvGW9rqYX+ LXKRb5rG5vC1ZZvlHkrzwUyvY9oioDrwhEsWVqjtqH54m1IPc0zXm/mnYCKHClXtSaE3Vq 9qtXigy6yjzdFu5nnaiuT0Q/Gc2GcBgsSIheG+nwMVdRiVEnDdzFs2sPPC6RlbyVELtWb5 S5vUYBN2BslcmbRYvvJboAENzE0KWoooAEGAacP9PosK3fZ2VsTLELLOhvgHL42FivqmFi T4t5mTe+D9SdUMlWcAHxDywsLBNqFe+PKjH1haP3y8iPNRTxWH6V42rVV4Fcgg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MjqcG6XzkzFT0; Thu, 6 Oct 2022 11:54:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 296Bscg6093437; Thu, 6 Oct 2022 11:54:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 296Bsc41093436; Thu, 6 Oct 2022 11:54:38 GMT (envelope-from git) Date: Thu, 6 Oct 2022 11:54:38 GMT Message-Id: <202210061154.296Bsc41093436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 9e0edafe92ad - main - uslcom(4): Clear stall at every open. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e0edafe92ad9fc6745ee4c4c58e45a49b9e7ed1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665057279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eZAY08oZy1LcB1CdlZm5wnfa68OKxIJJOL4Wr5ZtesA=; b=dl2HBPTz+1p1bxiaflAJ9lPW6Aj+KBYzZ1XEMeIEXCAq85t17ArcFUb4OZ0wv5rDQ2txwI z1u5tUvpcO7DO+QW0oj6TkjLijT9n5ybeX2YP8qgZqE1tvKOl6Wk4hSDITf6sXgCHY0lcv TnL+/YqhqhxfIVhw/1a4NWLdPunc/kQc6pTNlqx3dPgQ5L32HnF3ghIyWJOb/COHsJma/f ezNn2nQeBqsetyhPNW+VgRudJwVrdEBthpKPt5At13PXA4R52inYe1v/HE6gWpq0laeiu+ hsIUK/C5NXyZza68tSSUt11KHMFv5ErQgYgLSdroH/mXlGSHUCAkta8R2mH2jQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665057279; a=rsa-sha256; cv=none; b=HrekRe8sikachCz1metyQu+pCxsDB0ozpx4+OWIZ/iJvizlyqlvTljtayEbR4kTH4/nTOd CYHLavEgaYjZrYiTJWId5YQBukGOXzYsxrweR7aF8bHDW7I49q4hogFkFSAP6vWfCmKGMk zUWT2ye2T2y5YYGuj3cTfh2cRVCE7mhD4w+bI6WDfnCDgPhhOwzkJ1rkcejcLnN60Y9fQO fa6SN1XfhUELq3KfNPhGFNMtD4Vqd56srbjFxK/gec7CCIbZ1K2KkwaqVMCJaoTzqt4cak S+LJ5AjwswlZRGkuZKDirSHMY5COei/AW4R3dFpcoHVStgBbzlOnJrL+gd8j6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9e0edafe92ad9fc6745ee4c4c58e45a49b9e7ed1 commit 9e0edafe92ad9fc6745ee4c4c58e45a49b9e7ed1 Author: Hans Petter Selasky AuthorDate: 2022-10-05 14:45:21 +0000 Commit: Hans Petter Selasky 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); }