Merge tag 'backlight-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / drivers / of / device.c
index 8b91ea241b10f553f058885b5cc083a35e2a81fe..e5f47cec75f34e046b15efbc5bcdc50073eff5c0 100644 (file)
@@ -60,11 +60,12 @@ int of_device_add(struct platform_device *ofdev)
        ofdev->name = dev_name(&ofdev->dev);
        ofdev->id = -1;
 
-       /* 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->dev.of_node));
+       /*
+        * If this device has not binding numa node in devicetree, that is
+        * of_node_to_nid returns NUMA_NO_NODE. device_add will assume that this
+        * device is on the same node as the parent.
+        */
+       set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node));
 
        return device_add(&ofdev->dev);
 }