From nobody Sat Mar 16 15:16:11 2024 X-Original-To: dev-commits-src-branches@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 4Txl7c09tGz5F1Kp; Sat, 16 Mar 2024 15:16:12 +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 4Txl7b6kktz4Fy6; Sat, 16 Mar 2024 15:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710602171; 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=4hsZwcCrG5LqBAdBSPIZcV/A6Piki1x4+vqAsWEBkKM=; b=goYZxSq6uH9i/H+ci9MUAPfoHuKwtHf3S7mMOSpW4gQlLrJXMBXEDlp8OgUL4sLOCo76JY Cr8Mh9ZzZGzWOvQoZTS7o3feUGOu5XU9aZSwz7amtgqCyh6cQFiu8Kn+CoyBurwPDz/gBS cm2qC1RhkNGLFVHUNhqY1WuE0tg6gMbR5tjy+toK/1yzYOf1tcqz9nTnIa2lW1LOkK4Xhu Ol7m+0MWlR1re/S9nz0g/ZlxnLxaDfHFQzAqkCK1JOcn5EpyPwv9/IdrgEcYXRPKArQEGf nTqJDilLNr4xOE2ZEmfcQtAAkRimssNhUSsVaC+59Hr2rELxGHJGQk5kYzAIQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710602171; a=rsa-sha256; cv=none; b=kahYXKoWeN4nVcsq94YLPqY1FyYmj35hDY63s61w6CQkPfbjaWhLwXslGccGCUlsguxxku T3LpJx3LhMMk1ZdmkoWucy36A/C7Lw1mn48F17xg+B86kD+XcLOEeFjb7J8ns91MEpd2pR C25LJmwIqCR0gzXeKMV+dFJWMWt0RJEJDSqNmqHfcyMD3ABCbps6NvApD6yNAO73YeDiwp 4QbJmo4kdsTHxmqvZ2UDyGECq1zoXJPR/bl+fBE9s0zqN72eUnr828mXwyYbBbu09oTyc/ +akFBR1YENTP92aQ7Dffanu3XsYeWUyS3bUwaL3DMhrXddUbQvQX9RsHgdhx1Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710602171; 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=4hsZwcCrG5LqBAdBSPIZcV/A6Piki1x4+vqAsWEBkKM=; b=w/4J2cbOGdY8lkMvozEQLGMZ5snxpka4PkYehnc5G2E6t638lWSOHA29vcR0mmuBUhZZ6J HfuW4GQsSnCHmO4tvqQMTjRZq1GWPgQR1m38kV3PYjUENSPwKZzCUgON1YlINaGgsScAXa RjyqhbsokABILUgulh+xKo00iDbNSEuf+xtOXavDWdcY98EviQj4cs3C4iGs/0rP0xtWED FSSgRJdKdfJl1djou7sd5lSEPAOxvVsHtm1Kz9SIVH8HF+RLgeinR4KgtPve7MZCyQMnxc BcNNf7udaXlxbN2VfZMaHofNdw1QmWh9EwTNjzqNb/+ExzxSgyx6k9iRGQAxIg== 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 4Txl7b6Kscz110w; Sat, 16 Mar 2024 15:16:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42GFGBFC062504; Sat, 16 Mar 2024 15:16:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42GFGBbt062501; Sat, 16 Mar 2024 15:16:11 GMT (envelope-from git) Date: Sat, 16 Mar 2024 15:16:11 GMT Message-Id: <202403161516.42GFGBbt062501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 98ee1305b692 - stable/14 - ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 98ee1305b6924675c1dc612dff5f912a5a0d84e1 Auto-Submitted: auto-generated The branch stable/14 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=98ee1305b6924675c1dc612dff5f912a5a0d84e1 commit 98ee1305b6924675c1dc612dff5f912a5a0d84e1 Author: Andriy Gapon AuthorDate: 2024-02-19 10:44:00 +0000 Commit: Andriy Gapon CommitDate: 2024-03-16 15:11:37 +0000 ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is active even after it detached. That's because a device(9) still remains. So, add device_is_alive(9) check for more accurate reporting. Reviewed by: markj (cherry picked from commit 8f374fa528d7643919bca1b4153dde03996305fe) --- sys/dev/usb/usb_generic.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/usb_generic.c b/sys/dev/usb/usb_generic.c index d8bc3a828282..c0af27d77e5d 100644 --- a/sys/dev/usb/usb_generic.c +++ b/sys/dev/usb/usb_generic.c @@ -2377,12 +2377,10 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags) break; case USB_IFACE_DRIVER_ACTIVE: - n = *u.pint & 0xFF; - iface = usbd_get_iface(f->udev, n); - - if (iface && iface->subdev) + if (iface != NULL && iface->subdev != NULL && + device_is_alive(iface->subdev)) error = 0; else error = ENXIO;