git: 291079d0ebdd - main - pci_host_generic: Simplify generic_pcie_translate_resource
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 05 Mar 2024 04:53:43 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=291079d0ebdd078840ccb27aaa5d286e03e2e7e6 commit 291079d0ebdd078840ccb27aaa5d286e03e2e7e6 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-03-05 04:53:21 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-03-05 04:53:21 +0000 pci_host_generic: Simplify generic_pcie_translate_resource Inline generic_pcie_translate_resource_common into its sole caller. No functional change. Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D44206 --- sys/dev/pci/pci_host_generic.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 0f85e23eb028..da49edcf91f5 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -504,8 +504,8 @@ generic_pcie_containing_range(device_t dev, int type, rman_res_t start, } static int -generic_pcie_translate_resource_common(device_t dev, int type, rman_res_t start, - rman_res_t end, rman_res_t *new_start, rman_res_t *new_end) +generic_pcie_translate_resource(device_t dev, int type, rman_res_t start, + rman_res_t *new_start) { struct pcie_range *range; @@ -513,34 +513,20 @@ generic_pcie_translate_resource_common(device_t dev, int type, rman_res_t start, switch (type) { case SYS_RES_IOPORT: case SYS_RES_MEMORY: - range = generic_pcie_containing_range(dev, type, start, end); + range = generic_pcie_containing_range(dev, type, start, start); if (range == NULL) return (ENOENT); - if (range != NULL) { - *new_start = start - range->pci_base + range->phys_base; - *new_end = end - range->pci_base + range->phys_base; - } + *new_start = start - range->pci_base + range->phys_base; break; default: /* No translation for non-memory types */ *new_start = start; - *new_end = end; break; } return (0); } -static int -generic_pcie_translate_resource(device_t bus, int type, - rman_res_t start, rman_res_t *newstart) -{ - rman_res_t newend; /* unused */ - - return (generic_pcie_translate_resource_common( - bus, type, start, start, newstart, &newend)); -} - struct resource * pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)