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: 5435211 X-Patchwork-Delegate: eduardo.valentin@ti.com 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4462FBEEA8 for ; Thu, 4 Dec 2014 04:14:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6EE3620254 for ; Thu, 4 Dec 2014 04:14:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E17220120 for ; Thu, 4 Dec 2014 04:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbaLDEOL (ORCPT ); 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=vPEU1m0Lv61wkztbjIVSqGy9b3D1CzduKEZ7z7Khmuw=; b=fmVXPCZzJpIaVGHQV0uNRjvQAk1ZKZ+7J0chu2L2CQ5n0b0DbhSh3PyvXRPuHHASAt pcpjfkMBgQ0dcY2G2INEq+getmAkVJpZMkUkwH1qdw2SEHQWi/019rAvL38B4I/0I/r+ CPujTydHkAK3BLfUUzc4OLXIQGwUHmm7nsibR4WGmgg8BD4n2OvKD9dEW47c9MshsUMX 325QcHsPrmH6HxCeT5sQb1nrcd0wJGHGGavodaWMDenrsG+wbvJ+/d9LnXuLxyQeoO1R EsyLD7xa+2bDS4APUKVj1MQMZwZmPftffVD0jiy62s/j93oY5/eYXOR1z85sfIUmjbn5 MMFg== X-Gm-Message-State: ALoCoQkgG5w4CSuRG7vCMyRipy8ES24jeneBRXgweGbbABXKPJA5KFn6QJt3eN00JFpD0Vl7MIKI 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: 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=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 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);