From patchwork Wed Jul 1 04:07:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pi-cheng.chen" X-Patchwork-Id: 50505 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 36B34218E4 for ; Wed, 1 Jul 2015 04:07:57 +0000 (UTC) Received: by lbbui3 with SMTP id ui3sf2335168lbb.2 for ; Tue, 30 Jun 2015 21:07:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=tzl/uHQpJQZOCQYxqBPBndRcgtPkk28iD0Sa03izAQg=; b=XRjFDd3qp2LInPOWK53Xn61K0xYy0/LhkHZKX/JqAkwC7LCDvxmi/FDwEqNSaCUpv9 nJdC8wAbrFwQphKA2TvQfARTenGE7kZ9nJUp+gv4+CezaWuMPpRvfmsmD7TT60QD/za1 dVbHCJe6FAAksorrgA+SaIkNBkO2Wq3gU5yawKDZbmzRfcZOyYkPoyX8s6HHSwrvs5ro b5sxu09DKHjKVPk0/BAGFC0Dw+wa/UFcGg9OruPjSMlDjT8ebCDCOdzJANmnbTJ8wDhU /EFxzR0UWY/IdNVTpf6gkKk6SO3Tu7V3VX6RjHOMkxAQe1DZWtXg+QOx1jH3HRYLikPo jJxg== X-Gm-Message-State: ALoCoQnrHlTSa6KAYRcGJDGnuHejQoTGj4Jr4hmUwJXcTSm28mvLzXRkidVFdmyMffzIAMUFwdxj X-Received: by 10.180.198.172 with SMTP id jd12mr13735337wic.5.1435723675973; Tue, 30 Jun 2015 21:07:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.111 with SMTP id q15ls115679laa.28.gmail; Tue, 30 Jun 2015 21:07:55 -0700 (PDT) X-Received: by 10.112.29.110 with SMTP id j14mr22823794lbh.5.1435723675810; Tue, 30 Jun 2015 21:07:55 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id b8si514500lbg.101.2015.06.30.21.07.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2015 21:07:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lagh6 with SMTP id h6so32551415lag.2 for ; Tue, 30 Jun 2015 21:07:55 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr22431012lbc.41.1435723675679; Tue, 30 Jun 2015 21:07:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp326649lbb; Tue, 30 Jun 2015 21:07:54 -0700 (PDT) X-Received: by 10.68.142.232 with SMTP id rz8mr49820639pbb.117.1435723673981; Tue, 30 Jun 2015 21:07:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pl6si1093333pdb.124.2015.06.30.21.07.52; Tue, 30 Jun 2015 21:07:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750808AbbGAEHi (ORCPT + 11 others); Wed, 1 Jul 2015 00:07:38 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:36505 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750783AbbGAEHg (ORCPT ); Wed, 1 Jul 2015 00:07:36 -0400 Received: by paceq1 with SMTP id eq1so15976606pac.3 for ; Tue, 30 Jun 2015 21:07:35 -0700 (PDT) X-Received: by 10.67.7.162 with SMTP id dd2mr49317169pad.151.1435723655167; Tue, 30 Jun 2015 21:07:35 -0700 (PDT) Received: from localhost.localdomain ([124.219.30.17]) by mx.google.com with ESMTPSA id nb10sm465564pdb.76.2015.06.30.21.07.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jun 2015 21:07:34 -0700 (PDT) From: Pi-Cheng Chen To: Zhang Rui , Eduardo Valentin Cc: linux-pm@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] thermal: cpu_cooling: Iterate over all CPUs in clip_cpu mask to get frequency table Date: Wed, 1 Jul 2015 12:07:27 +0800 Message-Id: <1435723647-3354-1-git-send-email-pi-cheng.chen@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pi-cheng.chen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , __cpufreq_cooling_register() might fail if some CPU other than first one in clip_cpu mask is present earlier e.g. CPU hotplug. Iterate all CPUs in the mask to handle this case. Signed-off-by: Pi-Cheng Chen --- drivers/thermal/cpu_cooling.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 6509c61..d5e4ea8 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -776,7 +776,13 @@ __cpufreq_cooling_register(struct device_node *np, char dev_name[THERMAL_NAME_LENGTH]; struct cpufreq_frequency_table *pos, *table; unsigned int freq, i, num_cpus; - int ret; + int ret, cpu; + + for_each_cpu(cpu, clip_cpus) { + table = cpufreq_frequency_get_table(cpu); + if (table) + break; + } table = cpufreq_frequency_get_table(cpumask_first(clip_cpus)); if (!table) {