Skip to content

Commit ccbd884

Browse files
committed
Merge branch 'pci/of'
- Unexport of_pci_parse_bus_range() since it's only used in of.c (Bjorn Helgaas) - Drop 'No bus range found' message so we don't complain when DTs don't specify the default 'bus-range = <0x00 0xff>' (Bjorn Helgaas) - Simplify devm_of_pci_get_host_bridge_resources() interface by dropping parameters that are always the same default values (Bjorn Helgaas) - Update comment reference to of_pci_get_host_bridge_resources(), which no longer exists (Bjorn Helgaas) - Rename the drivers/pci/of_property.c struct of_pci_range to of_pci_range_entry to avoid confusion with the global of_pci_range in include/linux/of_address.h (Bjorn Helgaas) * pci/of: PCI: of_property: Rename struct of_pci_range to of_pci_range_entry sparc/PCI: Update reference to devm_of_pci_get_host_bridge_resources() PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface PCI: of: Drop 'No bus range found' message PCI: Unexport of_pci_parse_bus_range()
2 parents f4a0927 + 42d9972 commit ccbd884

File tree

4 files changed

+13
-22
lines changed

4 files changed

+13
-22
lines changed

arch/sparc/kernel/pci_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
361361
int i, saw_mem, saw_io;
362362
int num_pbm_ranges;
363363

364-
/* Corresponding generic code in of_pci_get_host_bridge_resources() */
364+
/* Corresponds to generic devm_of_pci_get_host_bridge_resources() */
365365

366366
saw_mem = saw_io = 0;
367367
pbm_ranges = of_get_property(pbm->op->dev.of_node, "ranges", &i);

drivers/pci/of.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ EXPORT_SYMBOL_GPL(of_pci_get_devfn);
190190
*
191191
* Returns 0 on success or a negative error-code on failure.
192192
*/
193-
int of_pci_parse_bus_range(struct device_node *node, struct resource *res)
193+
static int of_pci_parse_bus_range(struct device_node *node,
194+
struct resource *res)
194195
{
195196
u32 bus_range[2];
196197
int error;
@@ -207,7 +208,6 @@ int of_pci_parse_bus_range(struct device_node *node, struct resource *res)
207208

208209
return 0;
209210
}
210-
EXPORT_SYMBOL_GPL(of_pci_parse_bus_range);
211211

212212
/**
213213
* of_get_pci_domain_nr - Find the host bridge domain number
@@ -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,14 +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;
349-
dev_info(dev, " No bus range found for %pOF, using %pR\n",
350-
dev_node, bus_range);
351346
} else {
352-
if (bus_range->end > bus_range->start + bus_max)
353-
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+
}
354352
}
355353
pci_add_resource(resources, bus_range);
356354

@@ -597,7 +595,7 @@ static int pci_parse_request_of_pci_ranges(struct device *dev,
597595
INIT_LIST_HEAD(&bridge->windows);
598596
INIT_LIST_HEAD(&bridge->dma_ranges);
599597

600-
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,
601599
&bridge->dma_ranges, &iobase);
602600
if (err)
603601
return err;

drivers/pci/of_property.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct of_pci_addr_pair {
2626
* side and the child address is the corresponding address on the secondary
2727
* side.
2828
*/
29-
struct of_pci_range {
29+
struct of_pci_range_entry {
3030
u32 child_addr[OF_PCI_ADDRESS_CELLS];
3131
u32 parent_addr[OF_PCI_ADDRESS_CELLS];
3232
u32 size[OF_PCI_SIZE_CELLS];
@@ -101,7 +101,7 @@ static int of_pci_prop_bus_range(struct pci_dev *pdev,
101101
static int of_pci_prop_ranges(struct pci_dev *pdev, struct of_changeset *ocs,
102102
struct device_node *np)
103103
{
104-
struct of_pci_range *rp;
104+
struct of_pci_range_entry *rp;
105105
struct resource *res;
106106
int i, j, ret;
107107
u32 flags, num;

drivers/pci/pci.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,6 @@ static inline u64 pci_rebar_size_to_bytes(int size)
808808
struct device_node;
809809

810810
#ifdef CONFIG_OF
811-
int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
812811
int of_get_pci_domain_nr(struct device_node *node);
813812
int of_pci_get_max_link_speed(struct device_node *node);
814813
u32 of_pci_get_slot_power_limit(struct device_node *node,
@@ -824,12 +823,6 @@ int devm_of_pci_bridge_init(struct device *dev, struct pci_host_bridge *bridge);
824823
bool of_pci_supply_present(struct device_node *np);
825824

826825
#else
827-
static inline int
828-
of_pci_parse_bus_range(struct device_node *node, struct resource *res)
829-
{
830-
return -EINVAL;
831-
}
832-
833826
static inline int
834827
of_get_pci_domain_nr(struct device_node *node)
835828
{

0 commit comments

Comments
 (0)