aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <Yinghai.Lu@Sun.COM>2008-02-19 06:20:41 -0500
committerIngo Molnar <mingo@elte.hu>2008-04-26 17:41:04 -0400
commit0d358f22f6c8f03ab215eee8d52b74f78cc3c7db (patch)
treea60a05c5b5a2727ef6e82b273aafe2121373d93d
parentd39398a333ddc490f842ccdd4b76c9674682aa5d (diff)
driver core: try parent numa_node at first before using default
in the device_add, we try to use use parent numa_node. need to make sure pci root bus's bridge device numa_node is set. then we could use device->numa_node direclty for all device. and don't need to call pcibus_to_node(). Signed-off-by: Yinghai Lu <yinghai.lu@sun.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--drivers/base/core.c14
-rw-r--r--drivers/pci/probe.c4
2 files changed, 15 insertions, 3 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 9248e0927d08..be288b5e4180 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -787,6 +787,10 @@ int device_add(struct device *dev)
787 parent = get_device(dev->parent); 787 parent = get_device(dev->parent);
788 setup_parent(dev, parent); 788 setup_parent(dev, parent);
789 789
790 /* use parent numa_node */
791 if (parent)
792 set_dev_node(dev, dev_to_node(parent));
793
790 /* first, register with generic layer. */ 794 /* first, register with generic layer. */
791 error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id); 795 error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id);
792 if (error) 796 if (error)
@@ -1306,8 +1310,11 @@ int device_move(struct device *dev, struct device *new_parent)
1306 dev->parent = new_parent; 1310 dev->parent = new_parent;
1307 if (old_parent) 1311 if (old_parent)
1308 klist_remove(&dev->knode_parent); 1312 klist_remove(&dev->knode_parent);
1309 if (new_parent) 1313 if (new_parent) {
1310 klist_add_tail(&dev->knode_parent, &new_parent->klist_children); 1314 klist_add_tail(&dev->knode_parent, &new_parent->klist_children);
1315 set_dev_node(dev, dev_to_node(new_parent));
1316 }
1317
1311 if (!dev->class) 1318 if (!dev->class)
1312 goto out_put; 1319 goto out_put;
1313 error = device_move_class_links(dev, old_parent, new_parent); 1320 error = device_move_class_links(dev, old_parent, new_parent);
@@ -1317,9 +1324,12 @@ int device_move(struct device *dev, struct device *new_parent)
1317 if (!kobject_move(&dev->kobj, &old_parent->kobj)) { 1324 if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
1318 if (new_parent) 1325 if (new_parent)
1319 klist_remove(&dev->knode_parent); 1326 klist_remove(&dev->knode_parent);
1320 if (old_parent) 1327 dev->parent = old_parent;
1328 if (old_parent) {
1321 klist_add_tail(&dev->knode_parent, 1329 klist_add_tail(&dev->knode_parent,
1322 &old_parent->klist_children); 1330 &old_parent->klist_children);
1331 set_dev_node(dev, dev_to_node(old_parent));
1332 }
1323 } 1333 }
1324 cleanup_glue_dir(dev, new_parent_kobj); 1334 cleanup_glue_dir(dev, new_parent_kobj);
1325 put_device(new_parent); 1335 put_device(new_parent);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a8efdaef1870..a40043bd3257 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -973,7 +973,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
973 dev->dev.release = pci_release_dev; 973 dev->dev.release = pci_release_dev;
974 pci_dev_get(dev); 974 pci_dev_get(dev);
975 975
976 set_dev_node(&dev->dev, pcibus_to_node(bus));
977 dev->dev.dma_mask = &dev->dma_mask; 976 dev->dev.dma_mask = &dev->dma_mask;
978 dev->dev.dma_parms = &dev->dma_parms; 977 dev->dev.dma_parms = &dev->dma_parms;
979 dev->dev.coherent_dma_mask = 0xffffffffull; 978 dev->dev.coherent_dma_mask = 0xffffffffull;
@@ -1128,6 +1127,9 @@ struct pci_bus * pci_create_bus(struct device *parent,
1128 goto dev_reg_err; 1127 goto dev_reg_err;
1129 b->bridge = get_device(dev); 1128 b->bridge = get_device(dev);
1130 1129
1130 if (!parent)
1131 set_dev_node(b->bridge, pcibus_to_node(b));
1132
1131 b->dev.class = &pcibus_class; 1133 b->dev.class = &pcibus_class;
1132 b->dev.parent = b->bridge; 1134 b->dev.parent = b->bridge;
1133 sprintf(b->dev.bus_id, "%04x:%02x", pci_domain_nr(b), bus); 1135 sprintf(b->dev.bus_id, "%04x:%02x", pci_domain_nr(b), bus);