All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Heikki Krogerus
	<heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Mathias Nyman
	<mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Linux USB List
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"devicetree@vger.kernel.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: devicetree: avoid duplicated matching code (was: Re: [PATCH 1/3] xhci: plat: adapt to unified device property interface)
Date: Mon, 25 Apr 2016 09:38:41 +0300	[thread overview]
Message-ID: <87mvoiry4u.fsf@intel.com> (raw)
In-Reply-To: <CAL_JsqLh76fPT0CWo6r=5TGJebXO5sLZ-BOtGZ=-fd1+n5S5eA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1578 bytes --]


Hi,

Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> writes:
> On Thu, Apr 21, 2016 at 8:57 AM, Felipe Balbi
> <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
>>
>> Hi,
>>
>> Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> writes:
>>> On Thu, Apr 21, 2016 at 6:20 AM, Felipe Balbi
>>> <felipe.balbi-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Heikki Krogerus <heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> writes:
>>>>> @@ -197,7 +196,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
>>>>>       }
>>>>>
>>>>>       xhci = hcd_to_xhci(hcd);
>>>>> -     match = of_match_node(usb_xhci_of_match, node);
>>>>> +     match = of_match_node(usb_xhci_of_match, pdev->dev.of_node);
>>>>
>>>> Rob, it's weird that OF-based drivers have to redo the same matching
>>>> which was already done by drivers/base/platform.c::platform_match() just
>>>> to get match->data. If we know we matched, couldn't we just cache a
>>>> pointer to match->data in struct device_node.data ? Something like
>>>> below? (completely untested)
>>>
>>> Yes, it is. AIUI, there is some sort of race condition in doing what
>>> you suggest though. IIRC, Grant did that and reverted it if you look
>>> at the git history.
>>
>> looking at drivers/base/platform.c I can't find anything along these
>> lines. Adding Grant.
>>
>> Grant, any memory left of this race ?
>
> https://lkml.org/lkml/2011/5/18/384
>
> tl;dr: matching and probe is not atomic.

cool, thanks

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

      parent reply	other threads:[~2016-04-25  6:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1461064246-27350-1-git-send-email-heikki.krogerus@linux.intel.com>
     [not found] ` <1461064246-27350-2-git-send-email-heikki.krogerus@linux.intel.com>
     [not found]   ` <1461064246-27350-2-git-send-email-heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-04-21 11:20     ` devicetree: avoid duplicated matching code (was: Re: [PATCH 1/3] xhci: plat: adapt to unified device property interface) Felipe Balbi
     [not found]       ` <87fuuf9pip.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-21 13:00         ` Rob Herring
     [not found]           ` <CAL_JsqLVAN_dEcGUbNyiBjFJTSPSPjMKzWG9QBoJ71whpfmBiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-21 13:57             ` Felipe Balbi
     [not found]               ` <874mav9i9z.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-22 13:25                 ` Rob Herring
     [not found]                   ` <CAL_JsqLh76fPT0CWo6r=5TGJebXO5sLZ-BOtGZ=-fd1+n5S5eA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-25  6:38                     ` Felipe Balbi [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=87mvoiry4u.fsf@intel.com \
    --to=felipe.balbi-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@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.