Skip to content

Commit

Permalink
PCI: Refactor pci_bus_assign_domain_nr() for CONFIG_PCI_DOMAINS_GENERIC
Browse files Browse the repository at this point in the history
Instead of assigning bus->domain_nr inside pci_bus_assign_domain_nr(),
return the domain and let the caller do the assignment.  Rename
pci_bus_assign_domain_nr() to pci_bus_find_domain_nr() to reflect this.

No functional change intended.

[bhelgaas: changelog]
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
  • Loading branch information
Tomasz Nowicki authored and Bjorn Helgaas committed Jun 10, 2016
1 parent 935c760 commit 9c7cb89
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -4941,7 +4941,7 @@ int pci_get_new_domain_nr(void)
}

#ifdef CONFIG_PCI_DOMAINS_GENERIC
void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent)
{
static int use_dt_domains = -1;
int domain = -1;
Expand Down Expand Up @@ -4985,7 +4985,7 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
domain = -1;
}

bus->domain_nr = domain;
return domain;
}
#endif
#endif
Expand Down
4 changes: 3 additions & 1 deletion drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,9 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
b->sysdata = sysdata;
b->ops = ops;
b->number = b->busn_res.start = bus;
pci_bus_assign_domain_nr(b, parent);
#ifdef CONFIG_PCI_DOMAINS_GENERIC
b->domain_nr = pci_bus_find_domain_nr(b, parent);
#endif
b2 = pci_find_bus(pci_domain_nr(b), bus);
if (b2) {
/* If we already got to this bus through a different bridge, ignore it */
Expand Down
7 changes: 1 addition & 6 deletions include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -1390,12 +1390,7 @@ static inline int pci_domain_nr(struct pci_bus *bus)
{
return bus->domain_nr;
}
void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
#else
static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
struct device *parent)
{
}
int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent);
#endif

/* some architectures require additional setup to direct VGA traffic */
Expand Down

0 comments on commit 9c7cb89

Please sign in to comment.