Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d358f22 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar
Browse files

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: default avatarYinghai Lu <yinghai.lu@sun.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent d39398a3
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -787,6 +787,10 @@ int device_add(struct device *dev)
	parent = get_device(dev->parent);
	parent = get_device(dev->parent);
	setup_parent(dev, parent);
	setup_parent(dev, parent);


	/* use parent numa_node */
	if (parent)
		set_dev_node(dev, dev_to_node(parent));

	/* first, register with generic layer. */
	/* first, register with generic layer. */
	error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id);
	error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id);
	if (error)
	if (error)
@@ -1306,8 +1310,11 @@ int device_move(struct device *dev, struct device *new_parent)
	dev->parent = new_parent;
	dev->parent = new_parent;
	if (old_parent)
	if (old_parent)
		klist_remove(&dev->knode_parent);
		klist_remove(&dev->knode_parent);
	if (new_parent)
	if (new_parent) {
		klist_add_tail(&dev->knode_parent, &new_parent->klist_children);
		klist_add_tail(&dev->knode_parent, &new_parent->klist_children);
		set_dev_node(dev, dev_to_node(new_parent));
	}

	if (!dev->class)
	if (!dev->class)
		goto out_put;
		goto out_put;
	error = device_move_class_links(dev, old_parent, new_parent);
	error = device_move_class_links(dev, old_parent, new_parent);
@@ -1317,9 +1324,12 @@ int device_move(struct device *dev, struct device *new_parent)
		if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
		if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
			if (new_parent)
			if (new_parent)
				klist_remove(&dev->knode_parent);
				klist_remove(&dev->knode_parent);
			if (old_parent)
			dev->parent = old_parent;
			if (old_parent) {
				klist_add_tail(&dev->knode_parent,
				klist_add_tail(&dev->knode_parent,
					       &old_parent->klist_children);
					       &old_parent->klist_children);
				set_dev_node(dev, dev_to_node(old_parent));
			}
		}
		}
		cleanup_glue_dir(dev, new_parent_kobj);
		cleanup_glue_dir(dev, new_parent_kobj);
		put_device(new_parent);
		put_device(new_parent);
+3 −1
Original line number Original line Diff line number Diff line
@@ -973,7 +973,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
	dev->dev.release = pci_release_dev;
	dev->dev.release = pci_release_dev;
	pci_dev_get(dev);
	pci_dev_get(dev);


	set_dev_node(&dev->dev, pcibus_to_node(bus));
	dev->dev.dma_mask = &dev->dma_mask;
	dev->dev.dma_mask = &dev->dma_mask;
	dev->dev.dma_parms = &dev->dma_parms;
	dev->dev.dma_parms = &dev->dma_parms;
	dev->dev.coherent_dma_mask = 0xffffffffull;
	dev->dev.coherent_dma_mask = 0xffffffffull;
@@ -1128,6 +1127,9 @@ struct pci_bus * pci_create_bus(struct device *parent,
		goto dev_reg_err;
		goto dev_reg_err;
	b->bridge = get_device(dev);
	b->bridge = get_device(dev);


	if (!parent)
		set_dev_node(b->bridge, pcibus_to_node(b));

	b->dev.class = &pcibus_class;
	b->dev.class = &pcibus_class;
	b->dev.parent = b->bridge;
	b->dev.parent = b->bridge;
	sprintf(b->dev.bus_id, "%04x:%02x", pci_domain_nr(b), bus);
	sprintf(b->dev.bus_id, "%04x:%02x", pci_domain_nr(b), bus);