From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e24smtp05.br.ibm.com (e24smtp05.br.ibm.com [32.104.18.26]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e24smtp05.br.ibm.com", Issuer "GeoTrust SSL CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id DB9052C00D4 for ; Fri, 3 May 2013 21:56:07 +1000 (EST) Received: from /spool/local by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 May 2013 08:55:53 -0300 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.13.184.26]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 34A4D1DC006E for ; Fri, 3 May 2013 07:55:50 -0400 (EDT) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay02.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r43BsjFE28967140 for ; Fri, 3 May 2013 08:54:46 -0300 Received: from d24av05.br.ibm.com (loopback [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r43Btl9N003824 for ; Fri, 3 May 2013 08:55:49 -0300 Message-ID: <5183A5C4.4030706@linux.vnet.ibm.com> Date: Fri, 03 May 2013 08:55:48 -0300 From: Kleber Sacilotto de Souza MIME-Version: 1.0 To: tony@bakeyournoodle.com Subject: Re: [PATCHv4 1/2] ppc64: perform proper max_bus_speed detection References: <1366844090-5492-1-git-send-email-lucaskt@linux.vnet.ibm.com> <1366844090-5492-2-git-send-email-lucaskt@linux.vnet.ibm.com> <20130424234838.GA1971@thor.bakeyournoodle.com> <51796928.2050406@linux.vnet.ibm.com> <51828481.2090406@linux.vnet.ibm.com> <20130503064008.GB4260@thor.bakeyournoodle.com> In-Reply-To: <20130503064008.GB4260@thor.bakeyournoodle.com> Content-Type: text/plain; charset=UTF-8 Cc: David Airlie , Brian King , dri-devel@lists.freedesktop.org, Alex Deucher , Jerome Glisse , Thadeu Lima de Souza Cascardo , Bjorn Helgaas , linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kleber Sacilotto de Souza Subject: Re: [PATCHv4 1/2] ppc64: perform proper max_bus_speed detection Date: Fri, 03 May 2013 08:55:48 -0300 Message-ID: <5183A5C4.4030706@linux.vnet.ibm.com> References: <1366844090-5492-1-git-send-email-lucaskt@linux.vnet.ibm.com> <1366844090-5492-2-git-send-email-lucaskt@linux.vnet.ibm.com> <20130424234838.GA1971@thor.bakeyournoodle.com> <51796928.2050406@linux.vnet.ibm.com> <51828481.2090406@linux.vnet.ibm.com> <20130503064008.GB4260@thor.bakeyournoodle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by gabe.freedesktop.org (Postfix) with ESMTP id 46702E64D9 for ; Fri, 3 May 2013 04:55:56 -0700 (PDT) Received: from /spool/local by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 May 2013 08:55:54 -0300 Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.13.184.25]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id B6E481DC006D for ; Fri, 3 May 2013 07:55:49 -0400 (EDT) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay03.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r43BsrdP42664044 for ; Fri, 3 May 2013 08:54:53 -0300 Received: from d24av05.br.ibm.com (loopback [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r43Btl9L003824 for ; Fri, 3 May 2013 08:55:48 -0300 In-Reply-To: <20130503064008.GB4260@thor.bakeyournoodle.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: tony@bakeyournoodle.com Cc: Brian King , dri-devel@lists.freedesktop.org, Michael Ellerman , Alex Deucher , Jerome Glisse , Thadeu Lima de Souza Cascardo , Bjorn Helgaas , linuxppc-dev@lists.ozlabs.org List-Id: dri-devel@lists.freedesktop.org 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