mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Peter Mamonov <pmamonov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] driver: add function to look up device by DT node
Date: Thu, 19 Dec 2019 11:55:14 +0100	[thread overview]
Message-ID: <8ecfb46e932d3153937f8d568ac0e8b37fe40cc0.camel@pengutronix.de> (raw)
In-Reply-To: <20191219105243.GA16955@localhost.localdomain>

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@pengutronix.de>
> > ---
> > 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2019-12-19 10:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19 10:10 Lucas Stach
2019-12-19 10:52 ` Peter Mamonov
2019-12-19 10:55   ` Lucas Stach [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ecfb46e932d3153937f8d568ac0e8b37fe40cc0.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=pmamonov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox