Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1719662

Re: [PATCH v2 2/5] powerpc: pseries: vio: match parent nodes with of_find_node_by_path

From Michael Ellerman <mpe@ellerman.id.au>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/5] powerpc: pseries: vio: match parent nodes with of_find_node_by_path
Date 2017-08-25 02:20 +0200
Message-ID <uiavT-5eJ-7@gated-at.bofh.it> (permalink)
References <ugWEF-60L-3@gated-at.bofh.it> <ugWEG-60L-19@gated-at.bofh.it> <uh9LA-6cY-9@gated-at.bofh.it> <ui4JQ-1xk-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Rob Herring <robh@kernel.org> writes:

> On Tue, Aug 22, 2017 at 12:12 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
>> Rob Herring <robh@kernel.org> writes:
>>
>>> In preparation to remove the full path from device_node.full_name, use
>>> of_find_node_by_path instead of open coding with strcmp.
>>>
>>> Signed-off-by: Rob Herring <robh@kernel.org>
>>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>> Cc: Paul Mackerras <paulus@samba.org>
>>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>>> Cc: linuxppc-dev@lists.ozlabs.org
>>> ---
>>> v2:
>>> - rebased to linux-next and removed spurious change fro patch 1.
>>>
>>>  arch/powerpc/platforms/pseries/vio.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
>>> index aa5ca74316fa..5754572deb23 100644
>>> --- a/arch/powerpc/platforms/pseries/vio.c
>>> +++ b/arch/powerpc/platforms/pseries/vio.c
>>> @@ -1357,9 +1357,9 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
>>>        */
>>>       parent_node = of_get_parent(of_node);
>>>       if (parent_node) {
>>> -             if (!strcmp(parent_node->full_name, "/ibm,platform-facilities"))
>>> +             if (parent_node == of_find_node_by_path("/ibm,platform-facilities"))
>>>                       family = PFO;
>>> -             else if (!strcmp(parent_node->full_name, "/vdevice"))
>>> +             else if (parent_node == of_find_node_by_path("/vdevice"))
>>>                       family = VDEVICE;
>>
>> This leaks references to the looked up nodes.
>>
>> Both these nodes are defined in PAPR (our hypervisor spec), and both of
>> them must have a device_type, either "ibm,platform-facilities" or
>> "vdevice".
>>
>> Looking at the commit that added the code I don't see any particular
>> reason it used the comparison against full_name, rather than using the
>> device_type.
>>
>> So I'm inclined to do this instead:
>>
>> diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
>> index 8a47f168476b..f26f906e6021 100644
>> --- a/arch/powerpc/platforms/pseries/vio.c
>> +++ b/arch/powerpc/platforms/pseries/vio.c
>> @@ -1357,9 +1357,9 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
>>          */
>>         parent_node = of_get_parent(of_node);
>>         if (parent_node) {
>> -               if (!strcmp(parent_node->full_name, "/ibm,platform-facilities"))
>> +               if (!strcmp(parent_node->type, "ibm,platform-facilities"))
>>                         family = PFO;
>> -               else if (!strcmp(parent_node->full_name, "/vdevice"))
>> +               else if (!strcmp(parent_node->type, "vdevice"))
>>                         family = VDEVICE;
>>                 else {
>>                         pr_warn("%s: parent(%s) of %s not recognized.\n",
>>
>>
>> I've checked both Qemu and kvmtool add the device_type, and I'm fairly
>> confident that PowerVM does too. Anyway I'll test it on all the machines
>> I can find.
>
> Okay, do you want me to respin the patch or will you update it with

I merged it. Should be in next today.

cheers

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] Removing full paths from DT full_name Rob Herring <robh@kernel.org> - 2017-08-21 17:20 +0200
  [PATCH v2 5/5] of/fdt: only store the device node basename in full_name Rob Herring <robh@kernel.org> - 2017-08-21 17:20 +0200
  [PATCH v2 2/5] powerpc: pseries: vio: match parent nodes with of_find_node_by_path Rob Herring <robh@kernel.org> - 2017-08-21 17:20 +0200
    Re: [PATCH v2 2/5] powerpc: pseries: vio: match parent nodes with of_find_node_by_path Michael Ellerman <mpe@ellerman.id.au> - 2017-08-22 07:20 +0200
      Re: [PATCH v2 2/5] powerpc: pseries: vio: match parent nodes with of_find_node_by_path Rob Herring <robh@kernel.org> - 2017-08-24 20:10 +0200
        Re: [PATCH v2 2/5] powerpc: pseries: vio: match parent nodes with of_find_node_by_path Michael Ellerman <mpe@ellerman.id.au> - 2017-08-25 02:20 +0200
  [PATCH v2 3/5] powerpc: pseries: remove dlpar_attach_node dependency on full path Rob Herring <robh@kernel.org> - 2017-08-21 17:20 +0200
    Re: [v2, 3/5] powerpc: pseries: remove dlpar_attach_node dependency on full path Michael Ellerman <patch-notifications@ellerman.id.au> - 2017-08-24 14:40 +0200
  [PATCH v2 4/5] powerpc: pseries: only store the device node basename in full_name Rob Herring <robh@kernel.org> - 2017-08-21 17:20 +0200

csiph-web