From patchwork Fri Nov 28 09:44:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41689 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 708BF244C2 for ; Fri, 28 Nov 2014 09:46:07 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf4047803eek.4 for ; Fri, 28 Nov 2014 01:46:06 -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=3d6R1A0eW+E5r3z+Ud2ihv9BFenr3jLekGTiMNPnw8A=; b=CW+ZAMEjh3VxYVV/NPfc90ofKOpV1Qo9mBL53SXrSEH866pGjdH4aR2XmGoie1l/0z nnOn6ud3V2AvGPty1B3pO0XWuYDkSdIq/yXjYAmfn3A/qqvoTrhzXAuhmWFQgftpl2pQ oBtmPbn0dwnqO6DT62OewJT9ZriM53HlgQzabg1aRYea3gk9NMD3W3qQ1OkTwR977Cl2 qlc1gVbWJc28csuB3jUpHi3p5TI2NPMAdWLLhopik6s5cvC9ebF+nvmGU6ZUY2Y8BG61 Z0QV3njEsWhBviA0Tr1Be+LKqXTeRg30TyXjDmrJo95saAW1am0RTGJhyPCsh8cD6fCW xwnw== X-Gm-Message-State: ALoCoQkS5gf/mm/lCaJ3iivTTXAsH0I2bfnwWDnFqKJrIPUm4zOB6nE4L6qNn0E5cFkTFsvbsKzZ X-Received: by 10.194.92.34 with SMTP id cj2mr224024wjb.5.1417167966742; Fri, 28 Nov 2014 01:46:06 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.37 with SMTP id ll5ls259200lac.53.gmail; Fri, 28 Nov 2014 01:46:06 -0800 (PST) X-Received: by 10.112.171.199 with SMTP id aw7mr25363794lbc.40.1417167966584; Fri, 28 Nov 2014 01:46:06 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id 9si9485802lar.40.2014.11.28.01.46.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Nov 2014 01:46:06 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id pn19so4674245lab.9 for ; Fri, 28 Nov 2014 01:46:06 -0800 (PST) X-Received: by 10.152.8.170 with SMTP id s10mr42868251laa.56.1417167966460; Fri, 28 Nov 2014 01:46:06 -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 ew9csp60526lbc; Fri, 28 Nov 2014 01:46:05 -0800 (PST) X-Received: by 10.68.138.202 with SMTP id qs10mr48993192pbb.83.1417167964842; Fri, 28 Nov 2014 01:46:04 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vj10si15336419pbc.138.2014.11.28.01.46.04 for ; Fri, 28 Nov 2014 01:46:04 -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 S1751427AbaK1JqC (ORCPT + 12 others); Fri, 28 Nov 2014 04:46:02 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:44489 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394AbaK1JqB (ORCPT ); Fri, 28 Nov 2014 04:46:01 -0500 Received: by mail-pd0-f178.google.com with SMTP id g10so6460860pdj.9 for ; Fri, 28 Nov 2014 01:46:00 -0800 (PST) X-Received: by 10.68.98.196 with SMTP id ek4mr71376823pbb.150.1417167960798; Fri, 28 Nov 2014 01:46:00 -0800 (PST) Received: from localhost ([122.167.111.40]) by mx.google.com with ESMTPSA id v7sm5362390pdl.5.2014.11.28.01.45.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Nov 2014 01:46:00 -0800 (PST) From: Viresh Kumar To: linux-pm@vger.kernel.org, edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, Viresh Kumar Subject: [PATCH 22/26] cpu_cooling: use cpufreq_dev_list instead of cpufreq_dev_count Date: Fri, 28 Nov 2014 15:14:16 +0530 Message-Id: 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.215.50 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 f76a665..4965a55 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -73,8 +73,6 @@ static DEFINE_IDR(cpufreq_idr); static LIST_HEAD(cpufreq_dev_list); static DEFINE_MUTEX(cooling_cpufreq_lock); -static unsigned int cpufreq_dev_count; - /* notify_table passes value to the CPUFREQ_ADJUST callback function. */ #define NOTIFY_INVALID NULL static struct cpufreq_cooling_device *notify_device; @@ -380,10 +378,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->head, &cpufreq_dev_list); mutex_unlock(&cooling_cpufreq_lock); @@ -455,11 +452,10 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) cpufreq_dev = cdev->devdata; mutex_lock(&cooling_cpufreq_lock); - cpufreq_dev_count--; list_del(&cpufreq_dev->head); /* 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);