From: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
To: tony@bakeyournoodle.com
Cc: David Airlie <airlied@linux.ie>,
Brian King <brking@linux.vnet.ibm.com>,
dri-devel@lists.freedesktop.org,
Alex Deucher <alexander.deucher@amd.com>,
Jerome Glisse <jglisse@redhat.com>,
Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCHv4 1/2] ppc64: perform proper max_bus_speed detection
Date: Fri, 03 May 2013 08:55:48 -0300 [thread overview]
Message-ID: <5183A5C4.4030706@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130503064008.GB4260@thor.bakeyournoodle.com>
On 05/03/2013 03:40 AM, Tony Breeds wrote:
> On Thu, May 02, 2013 at 12:21:37PM -0300, Kleber Sacilotto de Souza wrote:
>
>> Hi Tony,
>>
>> It seems Lucas' change is a bit incomplete and is not handling the reference counter to
>> the device_node correctly. Is the following change what you had in mind?
>
> Ahh Sorry I expected there would be a for_each_parent_of_node macro.
> I did a quick grep and it seems that's not very common, so open coding
> it should be fine.
>
>>
>> dn = pcibios_get_phb_of_node(bus);
>> if (!dn)
>> return 0;
>>
>> for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
>> pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn,
>> "ibm,pcie-link-speed-stats", NULL);
>> if (pcie_link_speed_stats)
>> break;
>> }
>>
>> of_node_put(pdn);
>
> I think you need the of_node_put() in the body of the loop, otherwise
> aren't you leaking refcounts?
of_get_next_parent() takes care of that. It does of_node_put() on the
current node after doing of_node_get() on the parent.
Thanks,
--
Kleber Sacilotto de Souza
IBM Linux Technology Center
WARNING: multiple messages have this Message-ID (diff)
From: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
To: tony@bakeyournoodle.com
Cc: Brian King <brking@linux.vnet.ibm.com>,
dri-devel@lists.freedesktop.org,
Michael Ellerman <michael@ellerman.id.au>,
Alex Deucher <alexander.deucher@amd.com>,
Jerome Glisse <jglisse@redhat.com>,
Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCHv4 1/2] ppc64: perform proper max_bus_speed detection
Date: Fri, 03 May 2013 08:55:48 -0300 [thread overview]
Message-ID: <5183A5C4.4030706@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130503064008.GB4260@thor.bakeyournoodle.com>
On 05/03/2013 03:40 AM, Tony Breeds wrote:
> On Thu, May 02, 2013 at 12:21:37PM -0300, Kleber Sacilotto de Souza wrote:
>
>> Hi Tony,
>>
>> It seems Lucas' change is a bit incomplete and is not handling the reference counter to
>> the device_node correctly. Is the following change what you had in mind?
>
> Ahh Sorry I expected there would be a for_each_parent_of_node macro.
> I did a quick grep and it seems that's not very common, so open coding
> it should be fine.
>
>>
>> dn = pcibios_get_phb_of_node(bus);
>> if (!dn)
>> return 0;
>>
>> for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
>> pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn,
>> "ibm,pcie-link-speed-stats", NULL);
>> if (pcie_link_speed_stats)
>> break;
>> }
>>
>> of_node_put(pdn);
>
> I think you need the of_node_put() in the body of the loop, otherwise
> aren't you leaking refcounts?
of_get_next_parent() takes care of that. It does of_node_put() on the
current node after doing of_node_get() on the parent.
Thanks,
--
Kleber Sacilotto de Souza
IBM Linux Technology Center
next prev parent reply other threads:[~2013-05-03 11:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 22:54 [PATCHv4 0/2] Speed Cap fixes for ppc64 lucaskt
2013-04-24 22:54 ` [PATCHv4 1/2] ppc64: perform proper max_bus_speed detection lucaskt
2013-04-24 23:48 ` Tony Breeds
2013-04-24 23:48 ` Tony Breeds
2013-04-25 17:34 ` Lucas Kannebley Tavares
2013-05-02 15:21 ` Kleber Sacilotto de Souza
2013-05-02 15:21 ` Kleber Sacilotto de Souza
2013-05-03 6:40 ` Tony Breeds
2013-05-03 6:40 ` Tony Breeds
2013-05-03 11:55 ` Kleber Sacilotto de Souza [this message]
2013-05-03 11:55 ` Kleber Sacilotto de Souza
2013-04-24 22:54 ` [PATCHv4 2/2] radeon: use max_bus_speed to activate gen2 speeds lucaskt
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=5183A5C4.4030706@linux.vnet.ibm.com \
--to=klebers@linux.vnet.ibm.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=bhelgaas@google.com \
--cc=brking@linux.vnet.ibm.com \
--cc=cascardo@linux.vnet.ibm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jglisse@redhat.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=tony@bakeyournoodle.com \
/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.