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: 5402531 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F12409F47A for ; Fri, 28 Nov 2014 09:46:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0CB9520142 for ; Fri, 28 Nov 2014 09:46:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1DF0620123 for ; Fri, 28 Nov 2014 09:46:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751427AbaK1JqC (ORCPT ); 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-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=FzZrkCgz+WeU/IyK3t7SOl9JXFyyxAnFj8FXhU9vNVY=; b=j8PdyzpLVq+kccuD8rxZisuLY+oBT/owKma6WrJ7xWZ0RoNDv0xkiGm0/QlKjOjIxD /GFHUXA2qb89ojP/0K0W1XgpreJRMHImuCOm3JP9sh7LFblgItYmdi5emhFJueMPGrqH o3mSDaYzZPZwjcdXiFnL17a/2zu4HSrKhdU1KqVQxptNUNkbcG0/J3REgoum7kG3D0JZ 7rtMYzrO9FNBRjrbxyZAK2tuEDf2ZseiEtzChSClf4DalWbF3VWa1aO2HSQkptw2IZyq pZ0sC2NjLMEiQ0hAjoxv1OR28UjbOEf1XeGRC/767RZcDnmyzOjUv6Cb7qcATmDVKsiY XF9A== X-Gm-Message-State: ALoCoQlNDym+iBnccvL3GfOo0voP6jkeoJN6i+V3ZjmMq93KrDnxkfvpsbMuijNbylS7GnFvTtnT 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: 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 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);