summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/of_device.c1
-rw-r--r--drivers/of/device.c11
2 files changed, 10 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 93ae5b169f41..f3c9cae01dd5 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -78,7 +78,6 @@ struct of_device *of_device_alloc(struct device_node *np,
dev->dev.parent = parent;
dev->dev.release = of_release_dev;
dev->dev.archdata.of_node = np;
- set_dev_node(&dev->dev, of_node_to_nid(np));
if (bus_id)
strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 51e5214071da..224ae6bc67b6 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -105,7 +105,16 @@ EXPORT_SYMBOL(of_release_dev);
int of_device_register(struct of_device *ofdev)
{
BUG_ON(ofdev->node == NULL);
- return device_register(&ofdev->dev);
+
+ device_initialize(&ofdev->dev);
+
+ /* device_add will assume that this device is on the same node as
+ * the parent. If there is no parent defined, set the node
+ * explicitly */
+ if (!ofdev->dev.parent)
+ set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->node));
+
+ return device_add(&ofdev->dev);
}
EXPORT_SYMBOL(of_device_register);