From nobody Mon Feb 19 10:44:44 2024 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 4TdfLN5j9Rz5BQqw; Mon, 19 Feb 2024 10:44:44 +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 4TdfLN4zBXz4lpc; Mon, 19 Feb 2024 10:44:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708339484; 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=Y8dJh06/2cfJxCRZWC2AzvfvRzMEFfTBPxcp8wiKguM=; b=L+pkHUfc3VDUeAew5PEN3GJYhDy/dH5jcMp2KgB0qWlYRfxbo58acdBnexbCNAPxIw3O7g TJKtBqDznJPl6EhU63xZG3EU5msmIQyBEMXfAbK9aJlrQsjJjdLzI4oaUInDRpo1Em7uN4 X3HIRB0QuG4bq15SxUAXlZrSKUxHEaEXhFMoyfdXjU2xIeWC4NVo856oaQ5O629L+s+AT3 eKEJvmqMdS0klnCUyZd/7hbsPvKoJeHga67Kge9YoXl0+a3sVT/QaVfDWnUuZAtufJ2EFz FrbwpiXE5gVa5ae8CTdvU/S2cLSn78rbOCfSjgjC+L01nRkUFUTJ8d3w+P10Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708339484; 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=Y8dJh06/2cfJxCRZWC2AzvfvRzMEFfTBPxcp8wiKguM=; b=balIZuj6XoS5GBpqR/uxkdoc6T0rA7QvZ6b8kj0pnm+UuOxDADAcILTMz0vXt22oVNJtUz u49lk/E5hL6GmOYLo+v1lcVqlOdoCImac+DgVoLQLjZnGdW75XM7PnIAyH2g0r3WMvKDlQ fQXHFP99fTSzt5TaJceH5lifP6E/Ux4pRtZMglJH46PyEYb60Uyjdpy8Y7b9Xhg6mSRIcv 8ldVwBeyPHVocli6t4WQ2cg2akkx+lcJ99oG0F5W2i5fttPH3IxCNJ01bMItZMeWoxG5G+ tBxlGmVe8G+J3nIx466goevocxKkswx45j9zLhhRXAnRFNeSY2+h8d7OPaFRZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708339484; a=rsa-sha256; cv=none; b=to0kFA1ZmGJ0QU5EY/qH4PBd6YOTz0XFQc5UAU2SfwVKyMDME9OLOpYIWiZl6Sj2z9K9Lo tByxQXcgq43EPDwvf4HzJ0oGq+89icm8LMp1lNt9UTWCa8bovS28YAh8MEHPIyBBcBwqep fIgdGVLUon15syZ9+/BmOXZSweXBMeqnfvWasG+ShD7lZ1QBn08HinCR4Fix0YH8firi+M 3hwaM07I1TrZa3FYa6OX5B82FMhqsoSeG9AoneyNkUECwZp1x1ADEJgG/+qFv8Z8hyUZQL ZH/TXhHec9ymLvFbnCl3zJpkuEo2pd8jj9Zbfi6ipXfhWKm0fUw6//s8Eh++UA== 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 4TdfLN41kHzXR8; Mon, 19 Feb 2024 10:44:44 +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 41JAii7w085538; Mon, 19 Feb 2024 10:44:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41JAiiAD085535; Mon, 19 Feb 2024 10:44:44 GMT (envelope-from git) Date: Mon, 19 Feb 2024 10:44:44 GMT Message-Id: <202402191044.41JAiiAD085535@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 8f374fa528d7 - main - ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver 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: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8f374fa528d7643919bca1b4153dde03996305fe Auto-Submitted: auto-generated The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=8f374fa528d7643919bca1b4153dde03996305fe commit 8f374fa528d7643919bca1b4153dde03996305fe Author: Andriy Gapon AuthorDate: 2024-02-19 10:44:00 +0000 Commit: Andriy Gapon CommitDate: 2024-02-19 10:44:00 +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 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43960 --- 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;