From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751518Ab3IIJXr (ORCPT ); Mon, 9 Sep 2013 05:23:47 -0400 Received: from service87.mimecast.com ([91.220.42.44]:53840 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231Ab3IIJXp convert rfc822-to-8bit (ORCPT ); Mon, 9 Sep 2013 05:23:45 -0400 Message-ID: <522D93D7.4010307@arm.com> Date: Mon, 09 Sep 2013 10:24:39 +0100 From: Sudeep KarkadaNagesha User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: Guennadi Liakhovetski , Shawn Guo CC: Sudeep KarkadaNagesha , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" , "devicetree@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , Viresh Kumar , Greg Kroah-Hartman , Benjamin Herrenschmidt , Jonas Bonn , Michal Simek , "Rafael J. Wysocki" , "grant.likely@linaro.org" , "rob.herring@calxeda.com" Subject: Re: [PATCH v4 12/19] cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes References: <1374492747-13879-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1376991021-12160-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1376991021-12160-13-git-send-email-Sudeep.KarkadaNagesha@arm.com> In-Reply-To: X-OriginalArrivalTime: 09 Sep 2013 09:23:41.0329 (UTC) FILETIME=[45F08010:01CEAD3E] X-MC-Unique: 113090910234302401 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/09/13 14:44, Guennadi Liakhovetski wrote: > Hi > > On Tue, 20 Aug 2013, Sudeep KarkadaNagesha wrote: > >> From: Sudeep KarkadaNagesha >> >> Now that the cpu device registration initialises the of_node(if available) >> appropriately for all the cpus, parsing here is redundant. >> >> This patch removes all DT parsing and uses cpu->of_node instead. >> >> Acked-by: Shawn Guo >> Acked-by: Rob Herring >> Acked-by: Viresh Kumar >> Signed-off-by: Sudeep KarkadaNagesha >> --- >> drivers/cpufreq/cpufreq-cpu0.c | 23 ++++------------------- >> 1 file changed, 4 insertions(+), 19 deletions(-) >> >> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.= >> c >> index ad1fde2..5b05c26 100644 >> --- a/drivers/cpufreq/cpufreq-cpu0.c >> +++ b/drivers/cpufreq/cpufreq-cpu0.c >> @@ -174,29 +174,17 @@ static struct cpufreq_driver cpu0_cpufreq_driver =3D = >> { >> =20 >> static int cpu0_cpufreq_probe(struct platform_device *pdev) >> { >> -=09struct device_node *np, *parent; >> +=09struct device_node *np; >> =09int ret; >> =20 >> -=09parent =3D of_find_node_by_path("/cpus"); >> -=09if (!parent) { >> -=09=09pr_err("failed to find OF /cpus\n"); >> -=09=09return -ENOENT; >> -=09} >> - >> -=09for_each_child_of_node(parent, np) { >> -=09=09if (of_get_property(np, "operating-points", NULL)) >> -=09=09=09break; >> -=09} >> +=09cpu_dev =3D &pdev->dev; >> =20 >> +=09np =3D of_node_get(cpu_dev->of_node); > > Has this actually been tested? This seems to break cpufreq-cpu0. The > reason is, that this probe function is called not for the DT CPU node, but > for a special virtual cpufreq-cpu0 platform device, typically created by > platforms, using > > platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); > > which then of course doesn't have on .of_node associated with it. > Hi Guennadi, Based on my understanding of the original code: cpu_dev = &pdev->dev; ... ret = of_init_opp_table(cpu_dev); of_init_opp_table needs cpu_dev to be get_cpu_device(0). My understanding was that platform using cpufreq-cpu0 sets &pdev->dev to get_cpu_device(0). But looks like that's not the case. Hi Shawn, Can you please clarify ? The fix would be as below but I would like to know if setting cpu_dev to get_cpu_device(0) instead of &pdev->dev has any impact on other parts of code using cpu_dev ? diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index cbfffa9..871c336 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -177,7 +177,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) struct device_node *np; int ret; - cpu_dev = &pdev->dev; + cpu_dev = get_cpu_device(0); np = of_node_get(cpu_dev->of_node); if (!np) { Regards, Sudeep From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sudeep KarkadaNagesha Subject: Re: [PATCH v4 12/19] cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes Date: Mon, 09 Sep 2013 10:24:39 +0100 Message-ID: <522D93D7.4010307@arm.com> References: <1374492747-13879-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1376991021-12160-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1376991021-12160-13-git-send-email-Sudeep.KarkadaNagesha@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Return-path: In-Reply-To: Sender: linux-pm-owner@vger.kernel.org To: Guennadi Liakhovetski , Shawn Guo Cc: Sudeep KarkadaNagesha , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" , "devicetree@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , Viresh Kumar , Greg Kroah-Hartman , Benjamin Herrenschmidt , Jonas Bonn , Michal Simek , "Rafael J. Wysocki" , "grant.likely@linaro.org" , "rob.herring@calxeda.com" List-Id: devicetree@vger.kernel.org On 06/09/13 14:44, Guennadi Liakhovetski wrote: > Hi > > On Tue, 20 Aug 2013, Sudeep KarkadaNagesha wrote: > >> From: Sudeep KarkadaNagesha >> >> Now that the cpu device registration initialises the of_node(if available) >> appropriately for all the cpus, parsing here is redundant. >> >> This patch removes all DT parsing and uses cpu->of_node instead. >> >> Acked-by: Shawn Guo >> Acked-by: Rob Herring >> Acked-by: Viresh Kumar >> Signed-off-by: Sudeep KarkadaNagesha >> --- >> drivers/cpufreq/cpufreq-cpu0.c | 23 ++++------------------- >> 1 file changed, 4 insertions(+), 19 deletions(-) >> >> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.= >> c >> index ad1fde2..5b05c26 100644 >> --- a/drivers/cpufreq/cpufreq-cpu0.c >> +++ b/drivers/cpufreq/cpufreq-cpu0.c >> @@ -174,29 +174,17 @@ static struct cpufreq_driver cpu0_cpufreq_driver =3D = >> { >> =20 >> static int cpu0_cpufreq_probe(struct platform_device *pdev) >> { >> -=09struct device_node *np, *parent; >> +=09struct device_node *np; >> =09int ret; >> =20 >> -=09parent =3D of_find_node_by_path("/cpus"); >> -=09if (!parent) { >> -=09=09pr_err("failed to find OF /cpus\n"); >> -=09=09return -ENOENT; >> -=09} >> - >> -=09for_each_child_of_node(parent, np) { >> -=09=09if (of_get_property(np, "operating-points", NULL)) >> -=09=09=09break; >> -=09} >> +=09cpu_dev =3D &pdev->dev; >> =20 >> +=09np =3D of_node_get(cpu_dev->of_node); > > Has this actually been tested? This seems to break cpufreq-cpu0. The > reason is, that this probe function is called not for the DT CPU node, but > for a special virtual cpufreq-cpu0 platform device, typically created by > platforms, using > > platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); > > which then of course doesn't have on .of_node associated with it. > Hi Guennadi, Based on my understanding of the original code: cpu_dev = &pdev->dev; ... ret = of_init_opp_table(cpu_dev); of_init_opp_table needs cpu_dev to be get_cpu_device(0). My understanding was that platform using cpufreq-cpu0 sets &pdev->dev to get_cpu_device(0). But looks like that's not the case. Hi Shawn, Can you please clarify ? The fix would be as below but I would like to know if setting cpu_dev to get_cpu_device(0) instead of &pdev->dev has any impact on other parts of code using cpu_dev ? diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index cbfffa9..871c336 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -177,7 +177,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) struct device_node *np; int ret; - cpu_dev = &pdev->dev; + cpu_dev = get_cpu_device(0); np = of_node_get(cpu_dev->of_node); if (!np) { Regards, Sudeep From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from service87.mimecast.com (service87.mimecast.com [91.220.42.44]) by ozlabs.org (Postfix) with ESMTP id 94DBF2C0120 for ; Mon, 9 Sep 2013 19:23:47 +1000 (EST) Message-ID: <522D93D7.4010307@arm.com> Date: Mon, 09 Sep 2013 10:24:39 +0100 From: Sudeep KarkadaNagesha MIME-Version: 1.0 To: Guennadi Liakhovetski , Shawn Guo Subject: Re: [PATCH v4 12/19] cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes References: <1374492747-13879-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1376991021-12160-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1376991021-12160-13-git-send-email-Sudeep.KarkadaNagesha@arm.com> In-Reply-To: Content-Type: text/plain; charset=WINDOWS-1252 Cc: Jonas Bonn , "devicetree@vger.kernel.org" , Michal Simek , "linux-pm@vger.kernel.org" , Sudeep KarkadaNagesha , Viresh Kumar , "linux-kernel@vger.kernel.org" , "rob.herring@calxeda.com" , "Rafael J. Wysocki" , Greg Kroah-Hartman , "grant.likely@linaro.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 06/09/13 14:44, Guennadi Liakhovetski wrote: > Hi >=20 > On Tue, 20 Aug 2013, Sudeep KarkadaNagesha wrote: >=20 >> From: Sudeep KarkadaNagesha >> >> Now that the cpu device registration initialises the of_node(if availabl= e) >> appropriately for all the cpus, parsing here is redundant. >> >> This patch removes all DT parsing and uses cpu->of_node instead. >> >> Acked-by: Shawn Guo >> Acked-by: Rob Herring >> Acked-by: Viresh Kumar >> Signed-off-by: Sudeep KarkadaNagesha >> --- >> drivers/cpufreq/cpufreq-cpu0.c | 23 ++++------------------- >> 1 file changed, 4 insertions(+), 19 deletions(-) >> >> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cp= u0.=3D >> c >> index ad1fde2..5b05c26 100644 >> --- a/drivers/cpufreq/cpufreq-cpu0.c >> +++ b/drivers/cpufreq/cpufreq-cpu0.c >> @@ -174,29 +174,17 @@ static struct cpufreq_driver cpu0_cpufreq_driver = =3D3D =3D >> { >> =3D20 >> static int cpu0_cpufreq_probe(struct platform_device *pdev) >> { >> -=3D09struct device_node *np, *parent; >> +=3D09struct device_node *np; >> =3D09int ret; >> =3D20 >> -=3D09parent =3D3D of_find_node_by_path("/cpus"); >> -=3D09if (!parent) { >> -=3D09=3D09pr_err("failed to find OF /cpus\n"); >> -=3D09=3D09return -ENOENT; >> -=3D09} >> - >> -=3D09for_each_child_of_node(parent, np) { >> -=3D09=3D09if (of_get_property(np, "operating-points", NULL)) >> -=3D09=3D09=3D09break; >> -=3D09} >> +=3D09cpu_dev =3D3D &pdev->dev; >> =3D20 >> +=3D09np =3D3D of_node_get(cpu_dev->of_node); >=20 > Has this actually been tested? This seems to break cpufreq-cpu0. The=20 > reason is, that this probe function is called not for the DT CPU node, bu= t=20 > for a special virtual cpufreq-cpu0 platform device, typically created by= =20 > platforms, using >=20 > =09platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); >=20 > which then of course doesn't have on .of_node associated with it. >=20 Hi Guennadi, Based on my understanding of the original code: cpu_dev =3D &pdev->dev; =09... =09ret =3D of_init_opp_table(cpu_dev); of_init_opp_table needs cpu_dev to be get_cpu_device(0). My understanding was that platform using cpufreq-cpu0 sets &pdev->dev to get_cpu_device(0). But looks like that's not the case. Hi Shawn, Can you please clarify ? The fix would be as below but I would like to know if setting cpu_dev to get_cpu_device(0) instead of &pdev->dev has any impact on other parts of code using cpu_dev ? diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.= c index cbfffa9..871c336 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -177,7 +177,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) struct device_node *np; int ret; - cpu_dev =3D &pdev->dev; + cpu_dev =3D get_cpu_device(0); np =3D of_node_get(cpu_dev->of_node); if (!np) { Regards, Sudeep From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sudeep.KarkadaNagesha@arm.com (Sudeep KarkadaNagesha) Date: Mon, 09 Sep 2013 10:24:39 +0100 Subject: [PATCH v4 12/19] cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes In-Reply-To: References: <1374492747-13879-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1376991021-12160-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1376991021-12160-13-git-send-email-Sudeep.KarkadaNagesha@arm.com> Message-ID: <522D93D7.4010307@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 06/09/13 14:44, Guennadi Liakhovetski wrote: > Hi > > On Tue, 20 Aug 2013, Sudeep KarkadaNagesha wrote: > >> From: Sudeep KarkadaNagesha >> >> Now that the cpu device registration initialises the of_node(if available) >> appropriately for all the cpus, parsing here is redundant. >> >> This patch removes all DT parsing and uses cpu->of_node instead. >> >> Acked-by: Shawn Guo >> Acked-by: Rob Herring >> Acked-by: Viresh Kumar >> Signed-off-by: Sudeep KarkadaNagesha >> --- >> drivers/cpufreq/cpufreq-cpu0.c | 23 ++++------------------- >> 1 file changed, 4 insertions(+), 19 deletions(-) >> >> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.= >> c >> index ad1fde2..5b05c26 100644 >> --- a/drivers/cpufreq/cpufreq-cpu0.c >> +++ b/drivers/cpufreq/cpufreq-cpu0.c >> @@ -174,29 +174,17 @@ static struct cpufreq_driver cpu0_cpufreq_driver =3D = >> { >> =20 >> static int cpu0_cpufreq_probe(struct platform_device *pdev) >> { >> -=09struct device_node *np, *parent; >> +=09struct device_node *np; >> =09int ret; >> =20 >> -=09parent =3D of_find_node_by_path("/cpus"); >> -=09if (!parent) { >> -=09=09pr_err("failed to find OF /cpus\n"); >> -=09=09return -ENOENT; >> -=09} >> - >> -=09for_each_child_of_node(parent, np) { >> -=09=09if (of_get_property(np, "operating-points", NULL)) >> -=09=09=09break; >> -=09} >> +=09cpu_dev =3D &pdev->dev; >> =20 >> +=09np =3D of_node_get(cpu_dev->of_node); > > Has this actually been tested? This seems to break cpufreq-cpu0. The > reason is, that this probe function is called not for the DT CPU node, but > for a special virtual cpufreq-cpu0 platform device, typically created by > platforms, using > > platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0); > > which then of course doesn't have on .of_node associated with it. > Hi Guennadi, Based on my understanding of the original code: cpu_dev = &pdev->dev; ... ret = of_init_opp_table(cpu_dev); of_init_opp_table needs cpu_dev to be get_cpu_device(0). My understanding was that platform using cpufreq-cpu0 sets &pdev->dev to get_cpu_device(0). But looks like that's not the case. Hi Shawn, Can you please clarify ? The fix would be as below but I would like to know if setting cpu_dev to get_cpu_device(0) instead of &pdev->dev has any impact on other parts of code using cpu_dev ? diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index cbfffa9..871c336 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -177,7 +177,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) struct device_node *np; int ret; - cpu_dev = &pdev->dev; + cpu_dev = get_cpu_device(0); np = of_node_get(cpu_dev->of_node); if (!np) { Regards, Sudeep