Thread (51 messages) 51 messages, 7 authors, 2019-01-25

Re: [PATCH v1 07/12] usb: roles: Find the usb role switch by also matching against the device node

From: Andy Shevchenko <hidden>
Date: 2018-12-03 08:17:34
Also in: linux-usb, lkml

On Mon, Dec 3, 2018 at 5:45 AM Yu Chen [off-list ref] wrote:
This patch adds code for supporting find usb role switch by matching against
the device node described using of_graph.
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_graph.h>
Keep it ordered.
+static int __switch_match_by_of_node(struct device *dev, const void *name)
+{
+       if (!dev->parent || !dev->parent->of_node)
+               return 0;
+
+       return of_node_name_eq(dev->parent->of_node, (const char *)name);
+}
I think Heikki has introduced some more generic function for this.
        sw = device_connection_find_match(dev, "usb-role-switch", NULL,
                                          usb_role_switch_match);
+       sw = of_graph_find_match_by_type(dev, "usb-role-switch");
Why this is here?! device_connection_find_match() should take care for OF case.

-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help