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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 3, 2018 at 5:45 AM Yu Chen <chenyu56@xxxxxxxxxx> 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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux