From nobody Fri Jan 16 19:40:49 2026 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 4dt9FG5Fgkz6NlgJ for ; Fri, 16 Jan 2026 19:40:50 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dt9FF43fpz3x4k for ; Fri, 16 Jan 2026 19:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592449; 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=nof4+ltlPTX8aRQTSQHg6KiecUvuhxS6giRHaNtXVIk=; b=kNpPiIhaf5SsSLwH8xMo5bZWPdnUNB9pGYu6vfOLpSYPWKbeY10Lqb3HImKpt2NQ4IoeEG Tel44pSPaw6LqajmWVtAZku2UUXVxIE/SsEGzBW/U852SOF9JMypO2kjYalqvfLr4qObpe VJ1qnsZj/JjdKbl+gywdLN/2sUWVTrf3LXpO2UVxnGbT9gc9klEvkVuTnQDIXidkj1iY9o 4sxaud4PXNn2XZzsoPFZeLIETpL9cfkBms97UkjqxD5DV/8rKdv8+nFLqGpPVStyfpHUyD ybmVNqDnFSmtHOa5yCS+jmOtuF6fzYyWwA+sMBkWkuNG/oSI7eoFdwFkuqKJIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592449; 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=nof4+ltlPTX8aRQTSQHg6KiecUvuhxS6giRHaNtXVIk=; b=xA0ZqHVM9jxt4kOfpcIHlDeqtGPZ9ysqtwoGFmTWGVlWwKQIdC6phw87tRtQFh8wjq6dfa jdq8bktVfrnIo6kLa50a1avdxkTKXAskX6ka5j3LHj5kJgRXoDt8IhAtaJc9C6stb0+1my E038O5FjA/0AL2M9dabJ9+7aWtft7Z7zBeIc/sQJmly4bYt/HKYjzIAZGS+1hX2wLY/Xuy bTR+4FZtwvll18Ihagx/UD/m+vMroLaokStE/ynFNoMYRS2NwnUTh3sayp2v+/khrleUQf p2+mSw1kzIo5ufQV9OzsU/RUUTvS1WCIRXdkP+gU1+MBTZ8Bqpz5YauVk8iJ7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768592449; a=rsa-sha256; cv=none; b=Q5eIotGpfcZe4zlCRpkppJmtJw3xZ8XcP7i1nQoSUOH8E+HUhKopbq42W0WTRbtfMT/khm E8Sftgsa9k3faNykvlvAmeyksDWulaoFN2XoiLcrpilI9dpZY5Pp07BzJ18AduEx9N2u+W m+CYzCBRYM70jvg7NaHDciQy5aDnocNDiakm9LCqR5pnXchqMqrMCZ5Q0UiYbGba7rgWht aQWV8u0ASdelfAV4FPBHdDi+vNxZdQgD9UbiQfuKLkk9IVDzqnajLnfhipUh+7Pf+wUiF1 HmM3eykA6I9ZllRgMr7FtpksvWpHimYVY+gvq/eFEvAYtpVbOXXsi+UbE+GQpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dt9FF3Vv7zCJy for ; Fri, 16 Jan 2026 19:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id dcf8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Jan 2026 19:40:49 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: baefe812214e - stable/14 - LinuxKPI: pci: implement for_each_pci_dev() and improve pci_get_device() 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: baefe812214ebdeb042cf5a85e8232f4ee1a97ab Auto-Submitted: auto-generated Date: Fri, 16 Jan 2026 19:40:49 +0000 Message-Id: <696a9441.dcf8.f09f6d6@gitrepo.freebsd.org> The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=baefe812214ebdeb042cf5a85e8232f4ee1a97ab commit baefe812214ebdeb042cf5a85e8232f4ee1a97ab Author: Bjoern A. Zeeb AuthorDate: 2025-09-04 20:20:15 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-01-16 19:37:46 +0000 LinuxKPI: pci: implement for_each_pci_dev() and improve pci_get_device() Implement for_each_pci_dev() needed by a wireless driver update. For that also improve pci_get_device() and add the functionality to support the odev argument to start searching from that. Sponsored by: The FreeBSD Foundation (intially) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52066 (cherry picked from commit 910cf345d0ee9a5d72856a1ba35382eb4f0db951) (cherry picked from commit 68f8fa4ada24aaf53a2d463b53259439dfb32146) --- sys/compat/linuxkpi/common/include/linux/pci.h | 3 +++ sys/compat/linuxkpi/common/src/linux_pci.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 614cea0e7144..8bfb3a6a9909 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1421,6 +1421,9 @@ linuxkpi_pci_get_device(uint32_t vendor, uint32_t device, struct pci_dev *odev) return (lkpi_pci_get_device(vendor, device, odev)); } +#define for_each_pci_dev(_pdev) \ + while ((_pdev = linuxkpi_pci_get_device(PCI_ANY_ID, PCI_ANY_ID, _pdev)) != NULL) + /* This is a FreeBSD extension so we can use bus_*(). */ static inline void linuxkpi_pcim_want_to_use_bus_functions(struct pci_dev *pdev) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 77acbc48c408..b2f526df0da2 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -290,12 +290,18 @@ lkpi_pci_get_device(uint32_t vendor, uint32_t device, struct pci_dev *odev) { struct pci_dev *pdev, *found; - KASSERT(odev == NULL, ("%s: odev argument not yet supported\n", __func__)); - found = NULL; spin_lock(&pci_lock); list_for_each_entry(pdev, &pci_devices, links) { - if (pdev->vendor == vendor && pdev->device == device) { + /* Walk until we find odev. */ + if (odev != NULL) { + if (pdev == odev) + odev = NULL; + continue; + } + + if ((pdev->vendor == vendor || vendor == PCI_ANY_ID) && + (pdev->device == device || device == PCI_ANY_ID)) { found = pdev; break; }