From patchwork Thu Dec 4 04:12:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41906 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1A91625E88 for ; Thu, 4 Dec 2014 04:14:16 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf10340269wgh.9 for ; Wed, 03 Dec 2014 20:14:15 -0800 (PST) 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:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=X5DpynUTnKkB5bj99Z0drDA6Df3nyWM9YpjKTliXXqU=; b=Xbv34l7ANt8lAFsa3CU/ok3CDieGQvb5F71O6xtQMjzDJNJ+zDy72WmuDSPBgVCk4U ZKHDheMYp25Rg3iH8dANNy0qMs/GTxuf4OhrpyXmupWKAOx0G61AtYoyhM+KQUTVuWYO m5ICSFEoobpPELfO5OQ1nArZPE8q52/PbnWw46v9F1unIuS/oFoIp92o18kcV5W2bP6x jrEv4JPOdu35tEVhrXGi7Pkb9sUi8ukcCyFjD/n9+7d7fTXNZ4VDpxyNx2jXhJ7p9QWt hEGQY/N1+yg9TJJSUzs2H6KWSBV8VjpIl5zK+mXEk7IOvIvhwP4J+MabOw/ZDj/CugSJ 7B8w== X-Gm-Message-State: ALoCoQmXnQZKE3mVKg5dPUfzLUnU/HQenAYaRYnaC/rCwmU7SqjQMiymFPr43du3LaBxK+DOwcUd X-Received: by 10.194.134.193 with SMTP id pm1mr1793168wjb.4.1417666455337; Wed, 03 Dec 2014 20:14:15 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.133 with SMTP id am5ls239917lac.54.gmail; Wed, 03 Dec 2014 20:14:15 -0800 (PST) X-Received: by 10.112.210.100 with SMTP id mt4mr7238942lbc.31.1417666455048; Wed, 03 Dec 2014 20:14:15 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id bd9si24656654lab.42.2014.12.03.20.14.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 20:14:15 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id n15so13543521lbi.16 for ; Wed, 03 Dec 2014 20:14:14 -0800 (PST) X-Received: by 10.153.7.170 with SMTP id dd10mr7227730lad.44.1417666454908; Wed, 03 Dec 2014 20:14:14 -0800 (PST) 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.184.201 with SMTP id ew9csp781110lbc; Wed, 3 Dec 2014 20:14:14 -0800 (PST) X-Received: by 10.67.13.38 with SMTP id ev6mr14519251pad.25.1417666453293; Wed, 03 Dec 2014 20:14:13 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id df1si18139882pdb.237.2014.12.03.20.14.12 for ; Wed, 03 Dec 2014 20:14:13 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbaLDEOL (ORCPT + 12 others); Wed, 3 Dec 2014 23:14:11 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:40548 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752582AbaLDEOL (ORCPT ); Wed, 3 Dec 2014 23:14:11 -0500 Received: by mail-pa0-f53.google.com with SMTP id kq14so17147023pab.12 for ; Wed, 03 Dec 2014 20:14:10 -0800 (PST) X-Received: by 10.70.87.145 with SMTP id ay17mr14437426pdb.119.1417666450835; Wed, 03 Dec 2014 20:14:10 -0800 (PST) Received: from localhost ([122.166.92.172]) by mx.google.com with ESMTPSA id ca3sm24367841pbb.84.2014.12.03.20.14.09 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 20:14:10 -0800 (PST) From: Viresh Kumar To: linux-pm@vger.kernel.org, edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, amit.daniel@samsung.com, javi.merino@arm.com, Viresh Kumar Subject: [PATCH V2 22/26] thermal: cpu_cooling: use cpufreq_dev_list instead of cpufreq_dev_count Date: Thu, 4 Dec 2014 09:42:04 +0530 Message-Id: <564b1bad6f91e237eee3eed823f45f3f32be1b48.1417664938.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.3.693.g996b0fd In-Reply-To: References: In-Reply-To: References: 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: viresh.kumar@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.217.171 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: , As we already have a list of cpufreq_cooling_devices now, lets use it instead of a local counter. Signed-off-by: Viresh Kumar --- drivers/thermal/cpu_cooling.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index d2e6f84..32ff6dc 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -71,8 +71,6 @@ struct cpufreq_cooling_device { static DEFINE_IDR(cpufreq_idr); static DEFINE_MUTEX(cooling_cpufreq_lock); -static unsigned int cpufreq_dev_count; - static LIST_HEAD(cpufreq_dev_list); /** @@ -419,10 +417,9 @@ __cpufreq_cooling_register(struct device_node *np, mutex_lock(&cooling_cpufreq_lock); /* Register the notifier for first cpufreq cooling device */ - if (cpufreq_dev_count == 0) + if (list_empty(&cpufreq_dev_list)) cpufreq_register_notifier(&thermal_cpufreq_notifier_block, CPUFREQ_POLICY_NOTIFIER); - cpufreq_dev_count++; list_add(&cpufreq_dev->node, &cpufreq_dev_list); mutex_unlock(&cooling_cpufreq_lock); @@ -495,10 +492,9 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) cpufreq_dev = cdev->devdata; mutex_lock(&cooling_cpufreq_lock); list_del(&cpufreq_dev->node); - cpufreq_dev_count--; /* Unregister the notifier for the last cpufreq cooling device */ - if (cpufreq_dev_count == 0) + if (list_empty(&cpufreq_dev_list)) cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, CPUFREQ_POLICY_NOTIFIER); mutex_unlock(&cooling_cpufreq_lock);