All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
To: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH] of: match by compatible property first
Date: Wed, 13 Jun 2012 09:01:39 +0200	[thread overview]
Message-ID: <20120613070138.GA5670@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <20120420132839.GB25662-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 2150 bytes --]

On Fri, Apr 20, 2012 at 03:28:40PM +0200, Thierry Reding wrote:
> * Rob Herring wrote:
> > On 04/20/2012 05:21 AM, Thierry Reding wrote:
> [...]
> > > +const struct of_device_id *of_match_compat(const struct of_device_id *matches,
> > > +					   const char *compat)
> > > +{
> > > +	while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
> > 
> > You are not using name or type here, so you can remove.
> 
> They are still required so we don't stop early. A match table could well have
> a first entry that has name and/or type set but not compatible, followed by a
> second entry with only compatible set.
> 
> > >  	while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
> > 
> > You don't need to check compatible ptr here.
> 
> For similar reasons as above this check needs to stay in.
> 
> > 
> > >  		int match = 1;
> > >  		if (matches->name[0])
> > > @@ -532,10 +558,7 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches,
> > >  		if (matches->type[0])
> > >  			match &= node->type
> > >  				&& !strcmp(matches->type, node->type);
> > > -		if (matches->compatible[0])
> > > -			match &= of_device_is_compatible(node,
> > > -						matches->compatible);
> > > -		if (match)
> > > +		if (match && !matches->compatible[0])
> > >  			return matches;
> > >  		matches++;
> > >  	}
> > > diff --git a/include/linux/of.h b/include/linux/of.h
> > > index bd52d83..23b5061 100644
> > > --- a/include/linux/of.h
> > > +++ b/include/linux/of.h
> > > @@ -231,6 +231,8 @@ extern const void *of_get_property(const struct device_node *node,
> > >  
> > >  extern int of_n_addr_cells(struct device_node *np);
> > >  extern int of_n_size_cells(struct device_node *np);
> > > +extern const struct of_device_id *of_match_compat(
> > > +	const struct of_device_id *matches, const char *compat);
> > 
> > Why does this need to be a public function?
> 
> It doesn't. I just thought it might be handy to have. I can make it static if
> you don't think it's useful generally.
> 
> Thierry

Rob,

Do you have further comments on this?

Thierry

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 192 bytes --]

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

  parent reply	other threads:[~2012-06-13  7:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20 10:21 [PATCH] of: match by compatible property first Thierry Reding
     [not found] ` <1334917312-21192-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-04-20 13:13   ` Rob Herring
     [not found]     ` <4F9160DF.70308-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-20 13:28       ` Thierry Reding
     [not found]         ` <20120420132839.GB25662-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2012-06-13  7:01           ` Thierry Reding [this message]
     [not found]             ` <20120613070138.GA5670-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-06-13 15:37               ` Rob Herring
     [not found]                 ` <4FD8B3D1.1090706-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-06-13 16:58                   ` Thierry Reding

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=20120613070138.GA5670@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding-rm9k5ik7kjkj5m59nbduvrnah6klmebb@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.