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: 2859891 Return-Path: X-Original-To: patchwork-linux-arm@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 EB9429F2D6 for ; Mon, 9 Sep 2013 09:24:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F11012016D for ; Mon, 9 Sep 2013 09:24:30 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 248AB2041F for ; Mon, 9 Sep 2013 09:24:26 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VIxhi-0004UZ-Pe; Mon, 09 Sep 2013 09:24:19 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VIxhg-0000CF-JZ; Mon, 09 Sep 2013 09:24:16 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VIxhd-0000B8-3J for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2013 09:24:14 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130909_052413_314296_020C74A1 X-CRM114-Status: GOOD ( 18.95 ) X-Spam-Score: -2.6 (--) Cc: Jonas Bonn , "devicetree@vger.kernel.org" , Michal Simek , Benjamin Herrenschmidt , "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" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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);