From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752559AbbBXNrj (ORCPT ); Tue, 24 Feb 2015 08:47:39 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:45901 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751663AbbBXNri (ORCPT ); Tue, 24 Feb 2015 08:47:38 -0500 Message-ID: <54EC80F1.9030403@ti.com> Date: Tue, 24 Feb 2015 19:17:29 +0530 From: Kishon Vijay Abraham I User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Axel Lin CC: Gabriel FERNANDEZ , Lee Jones , Alexandre Torgue , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/2] phy: miphy28lp: Avoid calling of_get_child_count() multiple times References: <1424778767.27320.2.camel@phoenix> In-Reply-To: <1424778767.27320.2.camel@phoenix> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tuesday 24 February 2015 05:22 PM, Axel Lin wrote: > Currently, of_get_child_count() is called in each iteration of the for loop in > miphy28lp_xlate(). This patch stores the return value of of_get_child_count() > in miphy_dev->nphys and call of_get_child_count() once in miphy28lp_probe(). > > Signed-off-by: Axel Lin > --- > drivers/phy/phy-miphy28lp.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c > index 9b2848e..d444932 100644 > --- a/drivers/phy/phy-miphy28lp.c > +++ b/drivers/phy/phy-miphy28lp.c > @@ -228,6 +228,7 @@ struct miphy28lp_dev { > struct regmap *regmap; > struct mutex miphy_mutex; > struct miphy28lp_phy **phys; > + int nphys; it can just be a local member to miphy28lp_xlate() since it's not used anywhere else. Cheers Kishon