]> rtime.felk.cvut.cz Git - vajnamar/linux-xlnx.git/commitdiff
dwc3: fix the logic for finding parent node
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Tue, 29 Aug 2017 15:53:21 +0000 (21:23 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 30 Aug 2017 06:41:51 +0000 (08:41 +0200)
The present logic doesn't fetch the correct parent node when two usb nodes
are enabled. It searches all nodes and doesn't fetch the first node with
matching compatible string when two usb nodes are enabled.
This patch fixes the logic by searching "xlnx,zynqmp-dwc3" compatible
string only in the parent nodes instead of the searching all nodes.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/dwc3/dwc3-of-simple.c

index c69957b58f4a52e29b1f5238028e2a430e86ad0a..4233923a2a7793e1814a654f1ee1cc8e48ff8705 100644 (file)
@@ -140,8 +140,15 @@ EXPORT_SYMBOL(dwc3_simple_check_quirks);
 
 void dwc3_simple_wakeup_capable(struct device *dev, bool wakeup)
 {
-       struct device_node *node =
-               of_find_compatible_node(dev->of_node, NULL, "xlnx,zynqmp-dwc3");
+       struct device_node *node = of_node_get(dev->parent->of_node);
+
+       /* check for valid parent node */
+       while (node) {
+               if (!of_device_is_compatible(node, "xlnx,zynqmp-dwc3"))
+                       node = of_get_next_parent(node);
+               else
+                       break;
+       }
 
        if (node)  {
                struct platform_device *pdev_parent;