Re: devicetree: avoid duplicated matching code (was: Re: [PATCH 1/3] xhci: plat: adapt to unified device property interface)

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

 



Hi,

Rob Herring <robh+dt@xxxxxxxxxx> writes:
> On Thu, Apr 21, 2016 at 8:57 AM, Felipe Balbi
> <felipe.balbi@xxxxxxxxxxxxxxx> wrote:
>>
>> Hi,
>>
>> Rob Herring <robh+dt@xxxxxxxxxx> writes:
>>> On Thu, Apr 21, 2016 at 6:20 AM, Felipe Balbi
>>> <felipe.balbi@xxxxxxxxxxxxxxx> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> 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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux