From patchwork Thu Feb 5 15:54:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 5785441 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0C50FBF440 for ; Thu, 5 Feb 2015 15:55:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 164552026F for ; Thu, 5 Feb 2015 15:55:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B0D9E20270 for ; Thu, 5 Feb 2015 15:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753854AbbBEPzI (ORCPT ); Thu, 5 Feb 2015 10:55:08 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:55471 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753331AbbBEPzH (ORCPT ); Thu, 5 Feb 2015 10:55:07 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NJB00G1C2VT9V60@mailout3.samsung.com>; Fri, 06 Feb 2015 00:55:06 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-96-54d392599a8b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E8.3A.09430.95293D45; Fri, 06 Feb 2015 00:55:05 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NJB0091F2VFU450@mmp1.samsung.com>; Fri, 06 Feb 2015 00:55:05 +0900 (KST) From: Lukasz Majewski To: Eduardo Valentin , Zhang Rui Cc: Linux PM list , "linux-samsung-soc@vger.kernel.org" , Bartlomiej Zolnierkiewicz , Lukasz Majewski , Amit Daniel Kachhap , Abhilash Kesavan , Abhilash Kesavan , Chanwoo Choi , Viresh Kumar , Lukasz Majewski Subject: [PATCH v2] cpufreq: exynos: Use simple approach to asses if cpu cooling can be used Date: Thu, 05 Feb 2015 16:54:49 +0100 Message-id: <1423151689-27490-1-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <20150204100025.565ee2b0@amdc2363> References: <20150204100025.565ee2b0@amdc2363> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHLMWRmVeSWpSXmKPExsVy+t9jAd3ISZdDDFqWmls8XrOYyaLhaojF xhnrWS2uf3nOajH/yjVWizV/lSzePOK2ePNwM6PF594jjBYzzu9jsnjysI/NYuNXDwcej52z 7rJ7LN7zksnjzrU9bB7rpr1l9ujbsorR4/MmuQC2KC6blNSczLLUIn27BK6M5Uv6WQv28Fdc OHONsYHxMk8XIyeHhICJxPHzb1khbDGJC/fWs3UxcnEICSxilPjyYBkjSEJIoItJ4nBPJYjN JqAn8fnuUyYQW0TAW+L1vumMIA3MAo+ZJea8388MkhAWiJPY/+EnWBGLgKrEzh2nWUBsXgE3 ics7G5ghtilKdD+bwAZicwroS8w7/ZoJYpmexKqDy9knMPIuYGRYxSiaWpBcUJyUnmukV5yY W1yal66XnJ+7iREcis+kdzCuarA4xCjAwajEw2ux71KIEGtiWXFl7iFGCQ5mJRHeO82XQ4R4 UxIrq1KL8uOLSnNSiw8xSnOwKInzKtm3hQgJpCeWpGanphakFsFkmTg4pRoYjXlWX79oNOv4 hFVfPk9VC7LtX9rJOGOV9dSJS1W/xZkW/phb9emjbjv3K9MLMeeVdi6uvJrWFHC5jvl8lFNU 8hSeGTdcthZtvGX3SPDwUen8qlLLV7O3yBgfTtr2av0OEabiyP+18lpr3yyKvty9auPeli0h +r/SJ3CIfg3hOhx8J+XTl1ihrUosxRmJhlrMRcWJABBzeVVBAgAA Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Commit: e725d26c4857e5e41975b5e74e64ce6ab09a7121 provided possibility to use device tree to asses if cpu can be used as cooling device. Since the code was somewhat awkward, simpler approach has been proposed. Test HW: Exynos 4412 - Odroid U3. Suggested-by: Viresh Kumar Signed-off-by: Lukasz Majewski Acked-by: Viresh Kumar --- Changes for v2: - Remove superfluous *np pointer --- drivers/cpufreq/exynos-cpufreq.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index 5e98c6b..82d2fbb 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c @@ -159,7 +159,7 @@ static struct cpufreq_driver exynos_driver = { static int exynos_cpufreq_probe(struct platform_device *pdev) { - struct device_node *cpus, *np; + struct device_node *cpu0; int ret = -EINVAL; exynos_info = kzalloc(sizeof(*exynos_info), GFP_KERNEL); @@ -206,28 +206,19 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) if (ret) goto err_cpufreq_reg; - cpus = of_find_node_by_path("/cpus"); - if (!cpus) { - pr_err("failed to find cpus node\n"); + cpu0 = of_get_cpu_node(0, NULL); + if (!cpu0) { + pr_err("failed to find cpu0 node\n"); return 0; } - np = of_get_next_child(cpus, NULL); - if (!np) { - pr_err("failed to find cpus child node\n"); - of_node_put(cpus); - return 0; - } - - if (of_find_property(np, "#cooling-cells", NULL)) { - cdev = of_cpufreq_cooling_register(np, + if (of_find_property(cpu0, "#cooling-cells", NULL)) { + cdev = of_cpufreq_cooling_register(cpu0, cpu_present_mask); if (IS_ERR(cdev)) pr_err("running cpufreq without cooling device: %ld\n", PTR_ERR(cdev)); } - of_node_put(np); - of_node_put(cpus); return 0;