[PATCH 28/28] PCI: Remove pci_bus_assign_domain_nr()

From: Yijing Wang
Date: Thu Jan 15 2015 - 22:52:44 EST


Now we save the domain number in pci_host_bridge,
we could remove pci_bus_assign_domain_nr() and
clean the domain member in pci_bus.

Signed-off-by: Yijing Wang <wangyijing@xxxxxxxxxx>
---
drivers/pci/pci.c | 48 +-----------------------------------------------
drivers/pci/probe.c | 12 ++++--------
include/linux/pci.h | 3 ---
3 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 72232d4..3eb3d8e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4472,6 +4472,7 @@ int pci_domain_nr(struct pci_bus *bus)
return host->domain;
}
EXPORT_SYMBOL_GPL(pci_domain_nr);
+#endif

#ifdef CONFIG_PCI_DOMAINS_GENERIC
void pci_host_assign_domain_nr(struct pci_host_bridge *host)
@@ -4519,53 +4520,6 @@ void pci_host_assign_domain_nr(struct pci_host_bridge *host)

host->domain_nr = domain;
}
-
-
-void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
-{
- static int use_dt_domains = -1;
- int domain = of_get_pci_domain_nr(parent->of_node);
-
- /*
- * Check DT domain and use_dt_domains values.
- *
- * If DT domain property is valid (domain >= 0) and
- * use_dt_domains != 0, the DT assignment is valid since this means
- * we have not previously allocated a domain number by using
- * pci_get_new_domain_nr(); we should also update use_dt_domains to
- * 1, to indicate that we have just assigned a domain number from
- * DT.
- *
- * If DT domain property value is not valid (ie domain < 0), and we
- * have not previously assigned a domain number from DT
- * (use_dt_domains != 1) we should assign a domain number by
- * using the:
- *
- * pci_get_new_domain_nr()
- *
- * API and update the use_dt_domains value to keep track of method we
- * are using to assign domain numbers (use_dt_domains = 0).
- *
- * All other combinations imply we have a platform that is trying
- * to mix domain numbers obtained from DT and pci_get_new_domain_nr(),
- * which is a recipe for domain mishandling and it is prevented by
- * invalidating the domain value (domain = -1) and printing a
- * corresponding error.
- */
- if (domain >= 0 && use_dt_domains) {
- use_dt_domains = 1;
- } else if (domain < 0 && use_dt_domains != 1) {
- use_dt_domains = 0;
- domain = pci_get_new_domain_nr();
- } else {
- dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n",
- parent->of_node->full_name);
- domain = -1;
- }
-
- bus->domain_nr = domain;
-}
-#endif
#endif

/**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0817910..d8b76ef 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -480,7 +480,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
}
}

-static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
+static struct pci_bus *pci_alloc_bus(void)
{
struct pci_bus *b;

@@ -495,10 +495,7 @@ static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
INIT_LIST_HEAD(&b->resources);
b->max_bus_speed = PCI_SPEED_UNKNOWN;
b->cur_bus_speed = PCI_SPEED_UNKNOWN;
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
- if (parent)
- b->domain_nr = parent->domain_nr;
-#endif
+
return b;
}

@@ -645,7 +642,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
/*
* Allocate a new bus, and inherit stuff from the parent..
*/
- child = pci_alloc_bus(parent);
+ child = pci_alloc_bus();
if (!child)
return NULL;

@@ -1865,14 +1862,13 @@ static struct pci_bus *pci_create_root_bus(
char *fmt;

parent = bridge->dev.parent;
- b = pci_alloc_bus(NULL);
+ b = pci_alloc_bus();
if (!b)
return NULL;

b->sysdata = dev_get_drvdata(&bridge->dev);
b->ops = ops;
b->number = b->busn_res.start = bridge->busnum;
- pci_bus_assign_domain_nr(b, parent);

bridge->bus = b;
b->bridge = get_device(&bridge->dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e7ca546..ac25d2a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -475,9 +475,6 @@ struct pci_bus {
unsigned char primary; /* number of primary bridge */
unsigned char max_bus_speed; /* enum pci_bus_speed */
unsigned char cur_bus_speed; /* enum pci_bus_speed */
-#ifdef CONFIG_PCI_DOMAINS_GENERIC
- int domain_nr;
-#endif

char name[48];

--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/