[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALabi0Gz-er6JKGCYB2UR8UR6uuk-A8H5TbR4DnbEO7gGu9bCw@mail.gmail.com>
Date: Tue, 9 Oct 2018 08:41:13 +0530
From: Silesh C V <svellattu@...sta.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>
Subject: Re: [PATCH v2 1/2] Driver core: add bus_find_device_by_fwnode
Hello Rafael,
On Mon, Oct 8, 2018 at 1:43 PM Rafael J. Wysocki <rafael@...nel.org> wrote:
>
> On Tue, Sep 25, 2018 at 7:29 AM Silesh C V <svellattu@...sta.com> wrote:
> >
> > Some drivers need to find the device on a bus having a specific firmware
> > node. Currently, such drivers have their own implementations to do this.
> > Provide a helper similar to bus_find_device_by_name so that each driver
> > does not have to reinvent this.
> >
> > Signed-off-by: Silesh C V <svellattu@...sta.com>
> >
> > ---
> > drivers/base/bus.c | 26 ++++++++++++++++++++++++++
> > include/linux/device.h | 3 +++
> > 2 files changed, 29 insertions(+)
> >
> > diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> > index 8bfd27e..148b198 100644
> > --- a/drivers/base/bus.c
> > +++ b/drivers/base/bus.c
> > @@ -17,6 +17,7 @@
> > #include <linux/string.h>
> > #include <linux/mutex.h>
> > #include <linux/sysfs.h>
> > +#include <linux/of.h>
> > #include "base.h"
> > #include "power/power.h"
> >
> > @@ -373,6 +374,31 @@ struct device *bus_find_device_by_name(struct bus_type *bus,
> > }
> > EXPORT_SYMBOL_GPL(bus_find_device_by_name);
> >
> > +static int match_fwnode(struct device *dev, void *data)
> > +{
> > + struct fwnode_handle *fwnode = data;
> > + struct device_node *of_node = to_of_node(fwnode);
> > +
> > + if (of_node)
> > + return dev->of_node == of_node;
> > + else
> > + return dev->fwnode == fwnode;
>
> Why don't you use dev_fwnode() here?
>
OK. Will send an updated patch.
Thanks,
Silesh.
Powered by blists - more mailing lists