Re: [PATCH] Driver core: add bus_find_device_by_of_node

From: Rafael J. Wysocki
Date: Fri Sep 21 2018 - 05:17:19 EST


On Fri, Sep 21, 2018 at 5:45 AM Silesh C V <svellattu@xxxxxxxxxx> wrote:
>
> Hello Rafael,
>
> On Thu, Sep 20, 2018 at 1:06 PM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
> >
> > On Thu, Sep 20, 2018 at 7:43 AM Silesh C V <svellattu@xxxxxxxxxx> wrote:
> > >
> > > Similar to bus_find_device_by_name, but finds the device having a
> > > specific of_node.
> >
> > First, what do you need it for? Please describe your use case in the changelog.
>
> This will be useful for drivers that do not register a platform_driver
> (but retrieve the "simple-bus" device_node using
> of_find_compatible_node etc.) but are still interested in the struct
> device.
>
> >
> > Second, what about a more generic bus_find_device_by_fwnode() ?
>
> If you think that the above requirement warrants the inclusion of
> bus_find_device_by_of_node, I can try implementing this in v2.

I'm not really sure what you mean, but if there is
bus_find_device_by_fwnode(), it will be useful not just for DT code,
but generally, and getting an of_node from fwnode is trivial.

Thanks,
Rafael