From patchwork Mon Jul 27 12:28:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51521 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id D50B322918 for ; Mon, 27 Jul 2015 12:29:31 +0000 (UTC) Received: by wilm20 with SMTP id m20sf27450229wil.2 for ; Mon, 27 Jul 2015 05:29:31 -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: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=earGadPtrbghynjRHzTLBhgHyXZuYyk1vFO6oCYE6jc=; b=OLMGHdin6KMulaoXcyhYPkdyuX6fU0FgPXAX+/iSMDtiaM4O+5EVJt3QlCnMORGv7h Ki2jzC0AHolFhUNFdKzIIsVCYN4XmQKO3q8EUOfdUMtqhv79qYtlyG6mKbdG/wMUOHA/ vxHp3IX+aExmDQigp2gaxBDZ0eQoPJd3164rkmdqLhGvv5ZUkZwUX0ikaCyvGo6Odasz gZoFVkvkWvvJVMCUfV0kLSQkhCBt29olsuV1fTRvgVP4zVS066EEBSiMfwQmejmpK3+N Do+z8vCzynCZ6uq+3cZ2CqYsubQaTd4Pflvmyac/N/bT8osxiyvUMCKrfSQDyMN2cyMT Z9vg== X-Gm-Message-State: ALoCoQkcuStvXrArjIRkK/S5moUxrFHy5T1gDIw7InC7tFiHj5ISDW8TR9zxMLK/3WYEZug5sqLB X-Received: by 10.180.186.36 with SMTP id fh4mr5215327wic.7.1438000171168; Mon, 27 Jul 2015 05:29:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.102 with SMTP id s6ls593286lag.102.gmail; Mon, 27 Jul 2015 05:29:30 -0700 (PDT) X-Received: by 10.112.140.132 with SMTP id rg4mr25362738lbb.49.1438000170901; Mon, 27 Jul 2015 05:29:30 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id j1si15138598lbc.15.2015.07.27.05.29.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jul 2015 05:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lahh5 with SMTP id h5so47875248lah.2 for ; Mon, 27 Jul 2015 05:29:30 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr26426651lay.72.1438000170787; Mon, 27 Jul 2015 05:29:30 -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.7.198 with SMTP id l6csp1502235lba; Mon, 27 Jul 2015 05:29:29 -0700 (PDT) X-Received: by 10.107.137.13 with SMTP id l13mr40873571iod.159.1438000163421; Mon, 27 Jul 2015 05:29:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rf7si28141008pdb.85.2015.07.27.05.29.22; Mon, 27 Jul 2015 05:29:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 S1753643AbbG0M3P (ORCPT + 28 others); Mon, 27 Jul 2015 08:29:15 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:34913 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753570AbbG0M3K (ORCPT ); Mon, 27 Jul 2015 08:29:10 -0400 Received: by pdrg1 with SMTP id g1so51514273pdr.2 for ; Mon, 27 Jul 2015 05:29:09 -0700 (PDT) X-Received: by 10.70.90.42 with SMTP id bt10mr67419746pdb.60.1438000149636; Mon, 27 Jul 2015 05:29:09 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id wp5sm29462520pab.22.2015.07.27.05.29.08 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 27 Jul 2015 05:29:08 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, preeti.lkml@gmail.com, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH V2 9/9] cpufreq: Get rid of ->governor_enabled and its lock Date: Mon, 27 Jul 2015 17:58:14 +0530 Message-Id: <3667769d0c2fe326f89171d87cfe1d5eb8686115.1437999691.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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.53 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: , Invalid state-transitions is verified by governor core now and there is no need to replicate that in cpufreq core. Stop verifying the same in cpufreq core. That will get rid of policy->governor_enabled and cpufreq_governor_lock. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 24 ------------------------ include/linux/cpufreq.h | 1 - 2 files changed, 25 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index f620055279f3..c0d49950db01 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -102,7 +102,6 @@ static LIST_HEAD(cpufreq_governor_list); static struct cpufreq_driver *cpufreq_driver; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); static DEFINE_RWLOCK(cpufreq_driver_lock); -DEFINE_MUTEX(cpufreq_governor_lock); /* Flag to suspend/resume CPUFreq governors */ static bool cpufreq_suspended; @@ -2076,21 +2075,6 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, pr_debug("%s: for CPU %u, event %u\n", __func__, policy->cpu, event); - mutex_lock(&cpufreq_governor_lock); - if ((policy->governor_enabled && event == CPUFREQ_GOV_START) - || (!policy->governor_enabled - && (event == CPUFREQ_GOV_LIMITS || event == CPUFREQ_GOV_STOP))) { - mutex_unlock(&cpufreq_governor_lock); - return -EBUSY; - } - - if (event == CPUFREQ_GOV_STOP) - policy->governor_enabled = false; - else if (event == CPUFREQ_GOV_START) - policy->governor_enabled = true; - - mutex_unlock(&cpufreq_governor_lock); - ret = policy->governor->governor(policy, event); if (!ret) { @@ -2098,14 +2082,6 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, policy->governor->initialized++; else if (event == CPUFREQ_GOV_POLICY_EXIT) policy->governor->initialized--; - } else { - /* Restore original values */ - mutex_lock(&cpufreq_governor_lock); - if (event == CPUFREQ_GOV_STOP) - policy->governor_enabled = true; - else if (event == CPUFREQ_GOV_START) - policy->governor_enabled = false; - mutex_unlock(&cpufreq_governor_lock); } if (((event == CPUFREQ_GOV_POLICY_INIT) && ret) || diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index bde1e567b3a9..5930c6b3a1d8 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -82,7 +82,6 @@ struct cpufreq_policy { unsigned int policy; /* see above */ struct cpufreq_governor *governor; /* see below */ void *governor_data; - bool governor_enabled; /* governor start/stop flag */ char last_governor[CPUFREQ_NAME_LEN]; /* last governor used */ struct work_struct update; /* if update_policy() needs to be