git: 971c9f57d7e6 - main - pci: Narrow the scope of recently-added PCI_IOV #ifdefs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 08 Aug 2024 19:42:32 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=971c9f57d7e6b55161fecc008e19f00ccaba8060 commit 971c9f57d7e6b55161fecc008e19f00ccaba8060 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-08-08 19:05:23 +0000 Commit: John Baldwin <jhb@FreeBSD.org> 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)