From patchwork Mon Sep 9 09:24:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep KarkadaNagesha X-Patchwork-Id: 2859871 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B6EBB9F2D6 for ; Mon, 9 Sep 2013 09:23:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C1A620430 for ; Mon, 9 Sep 2013 09:23:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76DC6203F0 for ; Mon, 9 Sep 2013 09:23:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751394Ab3IIJXq (ORCPT ); Mon, 9 Sep 2013 05:23:46 -0400 Received: from service87.mimecast.com ([91.220.42.44]:53838 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987Ab3IIJXp convert rfc822-to-8bit (ORCPT ); Mon, 9 Sep 2013 05:23:45 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 09 Sep 2013 10:23:43 +0100 Received: from [10.1.207.49] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 9 Sep 2013 10:23:41 +0100 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 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 ? if (!np) { Regards, Sudeep --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);