devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Josh Cartwright <joshc@codeaurora.org>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH] of: Turn of_match_node into a static inline when CONFIG_OF isn't set
Date: Tue, 11 Feb 2014 20:17:59 +0100	[thread overview]
Message-ID: <2194247.ngWdBSP92t@avalon> (raw)
In-Reply-To: <20140211180845.GG841@joshc.qualcomm.com>

Hi Josh,

On Tuesday 11 February 2014 12:08:46 Josh Cartwright wrote:
> On Tue, Feb 11, 2014 at 06:20:49PM +0100, Laurent Pinchart wrote:
> > On Tuesday 11 February 2014 10:48:26 Josh Cartwright wrote:
> > > On Tue, Feb 11, 2014 at 03:55:35PM +0100, Laurent Pinchart wrote:
> > > > On Tuesday 11 February 2014 08:41:08 Josh Cartwright wrote:
> > > > > On Tue, Feb 11, 2014 at 01:36:51PM +0100, Laurent Pinchart wrote:
> [..]
> 
> > > I am a bit weary about having an of_match_node() user that both directly
> > > dereferences the result (i.e. of_match_node(matches, np)->data) _and_
> > > builds when !CONFIG_OF; most likely due to a traumatic childhood event
> > > where demons flew out my nose.
> > 
> > I can assign the intermediate value to a variable before dereferencing it
> > and drop my of_match_node() patch if it makes everybody happier.
> 
> Assuming you also intend to handle the case of_match_node() may return
> NULL, or otherwise prevent the execution of this codepath when
> !CONFIG_OF, then, yes, that sounds good.

I'll condition the call of that function to IS_ENABLED(CONFIG_OF), yes.

> It sure would be convenient if platform_device had a 'const struct
> of_device_id *of_id_entry' member similar to the existing struct
> platform_device_id one, that was set up during platform device matching.
> Most platform_driver users of of_match_node() would simply go away.

There's definitely room for improvement (although in this particular case the 
driver handles an I2C device, not a platform device).

I've always been slightly bothered by the duplication of matching information 
between native/legacy device IDs and OF device IDs. I haven't really given 
this a thought though, but I believe something should be done.

I've just remembered that, in the I2C case, the I2C core selects the 
appropriate i2c_device_id matching entry based on the compatible string, 
provided that the i2c_device_id table matches the of_device_id table with I2C 
device names set to the OF compatible string with the vendor prefix stripped 
off. Just food for thought.

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2014-02-11 19:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1392122211-11422-1-git-send-email-laurent.pinchart@ ideasonboard.com>
2014-02-11 12:36 ` [PATCH] of: Turn of_match_node into a static inline when CONFIG_OF isn't set Laurent Pinchart
     [not found]   ` <1392122211-11422-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-02-11 14:41     ` Josh Cartwright
2014-02-11 14:55       ` Laurent Pinchart
2014-02-11 16:48         ` Josh Cartwright
     [not found]           ` <20140211164825.GC841-OP5zVEFNDbfdOxZ39nK119BPR1lH4CV8@public.gmane.org>
2014-02-11 17:20             ` Laurent Pinchart
2014-02-11 18:08               ` Josh Cartwright
     [not found]                 ` <20140211180845.GG841-OP5zVEFNDbfdOxZ39nK119BPR1lH4CV8@public.gmane.org>
2014-02-11 18:29                   ` Geert Uytterhoeven
2014-02-11 20:06                     ` Arnd Bergmann
2014-02-12 21:54                       ` Geert Uytterhoeven
     [not found]                         ` <CAMuHMdVOkUMxEkUK70Y=Y126XmqgKMpyqmGRG5us7vZPhP8WNw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-02-13  1:01                           ` Josh Cartwright
     [not found]                     ` <CAMuHMdVkPLe5986hYPApoQr7oJSb6U2P71=nP+9mtvtaskdHXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-02-11 21:30                       ` Rob Herring
     [not found]                         ` <CAL_JsqKnsr-9nSjCGvroC0nDK36vQUnwMWj=cPjvUbRymmHFOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-02-11 21:55                           ` Josh Cartwright
     [not found]                             ` <20140211215519.GJ841-OP5zVEFNDbfdOxZ39nK119BPR1lH4CV8@public.gmane.org>
2014-02-11 23:14                               ` Rob Herring
     [not found]                                 ` <CAL_JsqJdbBuv0TgN7Okrxa4MmEon6a74hv458VFS=8RpcyX5tw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-02-12  2:15                                   ` Josh Cartwright
2014-02-11 19:17                 ` Laurent Pinchart [this message]
2014-02-17 18:19             ` Grant Likely
2014-02-17 18:18   ` Grant Likely
     [not found]     ` <20140217181829.B5F80C40372-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-02-17 19:50       ` Laurent Pinchart

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=2194247.ngWdBSP92t@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=joshc@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).