From 357518fa34d9dceda42bfc09642356a58370050d Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Sat, 10 Jun 2006 20:53:06 +1000 Subject: [POWERPC] pcibus_to_node fixes of_node_to_nid returns -1 if the associativity cannot be found. This means pcibus_to_cpumask has to be careful not to pass a negative index into node_to_cpumask. Since pcibus_to_node could be used a lot, and of_node_to_nid is slow (it walks a list doing strcmps), lets also cache the node in the pci_controller struct. Signed-off-by: Anton Blanchard Signed-off-by: Paul Mackerras --- include/asm-powerpc/topology.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'include/asm-powerpc/topology.h') diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h index b7abd423c570..f4c759b5f6cc 100644 --- a/include/asm-powerpc/topology.h +++ b/include/asm-powerpc/topology.h @@ -32,13 +32,13 @@ static inline int node_to_first_cpu(int node) int of_node_to_nid(struct device_node *device); -#ifdef CONFIG_PPC64 -#define pcibus_to_node(bus) (of_node_to_nid(bus->sysdata)) -#define pcibus_to_cpumask(bus) (node_to_cpumask(of_node_to_nid(bus->sysdata))) -#else -#define pcibus_to_node(node) (-1) -#define pcibus_to_cpumask(bus) (cpu_online_map) -#endif +struct pci_bus; +extern int pcibus_to_node(struct pci_bus *bus); + +#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \ + CPU_MASK_ALL : \ + node_to_cpumask(pcibus_to_node(bus)) \ + ) /* sched_domains SD_NODE_INIT for PPC64 machines */ #define SD_NODE_INIT (struct sched_domain) { \ -- cgit v1.2.3-59-g8ed1b