Re: [PATCH] driver: add function to look up device by DT node

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

 



On Do, 2019-12-19 at 13:52 +0300, Peter Mamonov wrote:
> Hi, Lucas,
> 
> On Thu, Dec 19, 2019 at 11:10:11AM +0100, Lucas Stach wrote:
> > Useful if we need to remove a deivce from the Barebox internal DT.
> > 
> > Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
> > ---
> > This is a prerequisite for "ARM: zii-imx8mq-dev: add DT fixups",
> > which
> > I missed to send out in the series.
> > ---
> >  drivers/base/driver.c | 12 ++++++++++++
> >  include/driver.h      |  1 +
> >  2 files changed, 13 insertions(+)
> > 
> > diff --git a/drivers/base/driver.c b/drivers/base/driver.c
> > index eec2a2d8a2a5..437b0162d3f7 100644
> > --- a/drivers/base/driver.c
> > +++ b/drivers/base/driver.c
> > @@ -70,6 +70,18 @@ static struct device_d
> > *get_device_by_name_id(const char *name, int id)
> >  	return NULL;
> >  }
> >  
> > +struct device_d *get_device_by_device_node(struct device_node *np)
> > +{
> > +	struct device_d *dev;
> > +
> > +	for_each_device(dev) {
> > +		if(dev->device_node == np)
> > +			return dev;
> > +	}
> > +
> > +	return NULL;
> > +}
> > +
> 
> This is already implemented in `of_find_device_by_node`.

Thanks! How did I miss that?

Regards,
Lucas


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux