Skip to content

Commit bbaa022

Browse files
committed
PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface
Previously pci_parse_request_of_pci_ranges() supplied the default bus range to devm_of_pci_get_host_bridge_resources(), but that function is static and has no other callers, so there's no reason to complicate its interface by passing the default bus range. Drop the busno and bus_max parameters and use 0x0 and 0xff directly in devm_of_pci_get_host_bridge_resources(). Link: https://lore.kernel.org/r/[email protected] [bhelgaas: dev_warn() for invalid end of bus-range] Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent adda86b commit bbaa022

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/pci/of.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ EXPORT_SYMBOL_GPL(of_pci_check_probe_only);
302302
* devm_of_pci_get_host_bridge_resources() - Resource-managed parsing of PCI
303303
* host bridge resources from DT
304304
* @dev: host bridge device
305-
* @busno: bus number associated with the bridge root bus
306-
* @bus_max: maximum number of buses for this bridge
307305
* @resources: list where the range of resources will be added after DT parsing
308306
* @ib_resources: list where the range of inbound resources (with addresses
309307
* from 'dma-ranges') will be added after DT parsing
@@ -319,7 +317,6 @@ EXPORT_SYMBOL_GPL(of_pci_check_probe_only);
319317
* value if it failed.
320318
*/
321319
static int devm_of_pci_get_host_bridge_resources(struct device *dev,
322-
unsigned char busno, unsigned char bus_max,
323320
struct list_head *resources,
324321
struct list_head *ib_resources,
325322
resource_size_t *io_base)
@@ -343,12 +340,15 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev,
343340

344341
err = of_pci_parse_bus_range(dev_node, bus_range);
345342
if (err) {
346-
bus_range->start = busno;
347-
bus_range->end = bus_max;
343+
bus_range->start = 0;
344+
bus_range->end = 0xff;
348345
bus_range->flags = IORESOURCE_BUS;
349346
} else {
350-
if (bus_range->end > bus_range->start + bus_max)
351-
bus_range->end = bus_range->start + bus_max;
347+
if (bus_range->end > 0xff) {
348+
dev_warn(dev, " Invalid end bus number in %pR, defaulting to 0xff\n",
349+
bus_range);
350+
bus_range->end = 0xff;
351+
}
352352
}
353353
pci_add_resource(resources, bus_range);
354354

@@ -595,7 +595,7 @@ static int pci_parse_request_of_pci_ranges(struct device *dev,
595595
INIT_LIST_HEAD(&bridge->windows);
596596
INIT_LIST_HEAD(&bridge->dma_ranges);
597597

598-
err = devm_of_pci_get_host_bridge_resources(dev, 0, 0xff, &bridge->windows,
598+
err = devm_of_pci_get_host_bridge_resources(dev, &bridge->windows,
599599
&bridge->dma_ranges, &iobase);
600600
if (err)
601601
return err;

0 commit comments

Comments
 (0)