From nobody Thu Aug 08 19:42:32 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 4WfyB105dbz5S5vj; Thu, 08 Aug 2024 19:42:33 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WfyB06mNyz4mm6; Thu, 8 Aug 2024 19:42:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723146152; 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=iLMpwOvHNsgGoML8FiodgRG/7Zhbl8/vJYL5SFv8ons=; b=hJUVWKPsVa2oFdJn4hPiObsaniM8DpWxxO9IN22TQHjJKQSl7wPycO2xi8G6eq6whyGqRQ 35iDbfNQrQ+ooNrFIrAfvCmiP4V8Vg7Mb0j1Ct2noHyMknJUa3VQq7rT6IidVV8QJzveSO 6S82RN8Ql/rCTsP5Y9sMJAGgn68XYOHZu6Gice9drxSMQsf/XkgkarS7M9fkUoQWM8DZjh OGiwPLbCiXqAOqoKsO/93zaSCljxhfWF1dy9bF8AC7b8kJxbcZTiZcCpklVdO5wqj/hvea 9u/9MCuZo+3cI/MnuPMn2oo3TOLpKjVldkXpyIOKi+iM7yJWNRwTRv95cQfY4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723146152; a=rsa-sha256; cv=none; b=cEcSgsGgXZMNW7+woldc8mYgNWxOMtJLEgV1+w2aJ2zpEBhFcvvmLNQRRUb++cNwUJUF/k rE1AO50ohEw5PcM5jFyrmx+46MlCYt2Iy03akGaoHNmLa0bygJu/kAN5bl83b5vvwnis62 TdcvX3605AGkXsB5Jczxz+uVtAhGSieaLluJ35QhzUyy58TpxxvXfX3aJ5zrfLNFkNfoks WmW3rjhNATwMZ9ZpyD+PRidAx/ubl6d0WJ1d+FmttDQNS2QVlNcJVuT7Rum3aVydlUm65n WdvKwl1y8XDUpzZXZv0pkyHfFeRVjAdw4iO5EuT4LC1yJzc4rWD6ANU0iD0Etg== 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=1723146152; 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=iLMpwOvHNsgGoML8FiodgRG/7Zhbl8/vJYL5SFv8ons=; b=Us186FuaOWXgDeIFCwcDRs2RaFmuz8yhq4oGFBW0KKVKDdkgHqpry8aGlY7m5cU2HAuycX OnGuzye4zPXUXHAW1iD6O86pDYg+/HYMDuPGMdeAkqcKqPsZXuESr+ji6RYrmNcSla4C8/ 55bPchtmKhChBNhBVyzIXTeRwI7P4aa6upx3tIGZPzY6SxKmr7qEwCvb4AJw5DqFlbhsm6 RCeXvDxps6JbClBWN9Wg4WcRgW0fQPkcxBDUkWwGdLZqhlGMBR7WISSBptBh9cSFdUJIsy qggd5SEqaQk217bhj2gPNIbc++QjuM8VIpjKbRNlb6Eqcg+qfjZPaiYx56LodA== 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 4WfyB06NW3zmpR; Thu, 8 Aug 2024 19:42:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 478JgWfa082475; Thu, 8 Aug 2024 19:42:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 478JgWrK082472; Thu, 8 Aug 2024 19:42:32 GMT (envelope-from git) Date: Thu, 8 Aug 2024 19:42:32 GMT Message-Id: <202408081942.478JgWrK082472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 971c9f57d7e6 - main - pci: Narrow the scope of recently-added PCI_IOV #ifdefs 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 971c9f57d7e6b55161fecc008e19f00ccaba8060 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=971c9f57d7e6b55161fecc008e19f00ccaba8060 commit 971c9f57d7e6b55161fecc008e19f00ccaba8060 Author: John Baldwin AuthorDate: 2024-08-08 19:05:23 +0000 Commit: John Baldwin CommitDate: 2024-08-08 19:05:23 +0000 pci: Narrow the scope of recently-added PCI_IOV #ifdefs Push the #ifdefs down into the function body instead of defining functions conditionally for ease of readability. These aren't critical paths, so one extra branch in the !PCI_IOV case is not a big deal. Requested by: jrtc27 Differential Revision: https://reviews.freebsd.org/D45877 --- sys/dev/pci/pci.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index a2912f2a93ae..843f70a594a0 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -164,18 +164,12 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), DEVMETHOD(bus_delete_resource, pci_delete_resource), DEVMETHOD(bus_alloc_resource, pci_alloc_resource), -#ifdef PCI_IOV DEVMETHOD(bus_adjust_resource, pci_adjust_resource), -#else - DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), -#endif DEVMETHOD(bus_release_resource, pci_release_resource), DEVMETHOD(bus_activate_resource, pci_activate_resource), DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), -#ifdef PCI_IOV DEVMETHOD(bus_map_resource, pci_map_resource), DEVMETHOD(bus_unmap_resource, pci_unmap_resource), -#endif DEVMETHOD(bus_child_deleted, pci_child_deleted), DEVMETHOD(bus_child_detached, pci_child_detached), DEVMETHOD(bus_child_pnpinfo, pci_child_pnpinfo_method), @@ -5754,11 +5748,11 @@ pci_deactivate_resource(device_t dev, device_t child, struct resource *r) return (0); } -#ifdef PCI_IOV int pci_adjust_resource(device_t dev, device_t child, struct resource *r, rman_res_t start, rman_res_t end) { +#ifdef PCI_IOV struct pci_devinfo *dinfo; if (device_get_parent(child) != dev) @@ -5778,6 +5772,7 @@ pci_adjust_resource(device_t dev, device_t child, struct resource *r, /* Fall through for other types of resource allocations. */ } +#endif return (bus_generic_adjust_resource(dev, child, r, start, end)); } @@ -5786,6 +5781,7 @@ int pci_map_resource(device_t dev, device_t child, struct resource *r, struct resource_map_request *argsp, struct resource_map *map) { +#ifdef PCI_IOV struct pci_devinfo *dinfo; if (device_get_parent(child) != dev) @@ -5805,6 +5801,7 @@ pci_map_resource(device_t dev, device_t child, struct resource *r, /* Fall through for other types of resource allocations. */ } +#endif return (bus_generic_map_resource(dev, child, r, argsp, map)); } @@ -5813,6 +5810,7 @@ int pci_unmap_resource(device_t dev, device_t child, struct resource *r, struct resource_map *map) { +#ifdef PCI_IOV struct pci_devinfo *dinfo; if (device_get_parent(child) != dev) @@ -5830,10 +5828,10 @@ pci_unmap_resource(device_t dev, device_t child, struct resource *r, /* Fall through for other types of resource allocations. */ } +#endif return (bus_generic_unmap_resource(dev, child, r, map)); } -#endif void pci_child_deleted(device_t dev, device_t child)