From patchwork Tue Oct 13 08:09:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 54828 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 056C223001 for ; Tue, 13 Oct 2015 08:10:09 +0000 (UTC) Received: by wicid10 with SMTP id id10sf6069846wic.2 for ; Tue, 13 Oct 2015 01:10:08 -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=tHmiSStLzPV4NuK5YMnZEg4IfI/Q0tc6EoOMQlhwcEU=; b=bwmaQHeufI8y1xa/EU3gREhmNqvCgywjNzT17IG1lbb99RTLtRI31FVQPc2/5GnJw8 cuyXy+xRSxRJ2723nDgVgtUMCCmdaOY+R27kRC7eBCL8TcwORa01IWrMSr7unXgXDkHz FQmh7kYZQkgAgws+14mST4h1I3XU+SD+gSRUDQ+Wx1pxhCJsHCwQNcu6wWSQGBBcq/hu EbNN0aYa9fkSJxq6MWtbndVBhNL/CrsEPO94PgNwY1mrJOrzvMMVC1/sU2uNUQZqFUKT fHpT9IxjXe1ogK4yF471Ypfrm4s/lM+b7sJQWpYEEVS56BNkw9/17SQIRHhG4TDMILip YuWQ== X-Gm-Message-State: ALoCoQmaglK9sXj3VrvsPeE2jn8AmQ8WmAmasmBkEfSQFp4B5j9biCkFglNcSGw3/Oa0Q0U81Iec X-Received: by 10.112.144.99 with SMTP id sl3mr6544431lbb.12.1444723808029; Tue, 13 Oct 2015 01:10:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.24.84 with SMTP id o81ls6564lfi.48.gmail; Tue, 13 Oct 2015 01:10:07 -0700 (PDT) X-Received: by 10.25.26.146 with SMTP id a140mr9611740lfa.31.1444723807863; Tue, 13 Oct 2015 01:10:07 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id jv8si1369138lbc.86.2015.10.13.01.10.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2015 01:10:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbbck17 with SMTP id ck17so10383864lbb.1 for ; Tue, 13 Oct 2015 01:10:07 -0700 (PDT) X-Received: by 10.25.19.99 with SMTP id j96mr3498773lfi.106.1444723807731; Tue, 13 Oct 2015 01:10:07 -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.59.35 with SMTP id w3csp1974587lbq; Tue, 13 Oct 2015 01:10:05 -0700 (PDT) X-Received: by 10.107.26.138 with SMTP id a132mr32661167ioa.5.1444723805860; Tue, 13 Oct 2015 01:10:05 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si1843542igl.99.2015.10.13.01.10.05; Tue, 13 Oct 2015 01:10:05 -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 S932198AbbJMIJx (ORCPT + 30 others); Tue, 13 Oct 2015 04:09:53 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:35282 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752622AbbJMIJt (ORCPT ); Tue, 13 Oct 2015 04:09:49 -0400 Received: by pabve7 with SMTP id ve7so14413115pab.2 for ; Tue, 13 Oct 2015 01:09:49 -0700 (PDT) X-Received: by 10.66.235.4 with SMTP id ui4mr38674822pac.129.1444723789169; Tue, 13 Oct 2015 01:09:49 -0700 (PDT) Received: from localhost ([223.227.239.124]) by smtp.gmail.com with ESMTPSA id yq2sm2242578pbb.39.2015.10.13.01.09.47 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Oct 2015 01:09:48 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH V3 5/5] cpufreq: Get rid of ->governor_enabled and its lock Date: Tue, 13 Oct 2015 13:39:05 +0530 Message-Id: <123bfd25c7433733005efd57f819a27471471f81.1444723240.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.217.181 as permitted sender) smtp.mailfrom=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 25c4c15103a0..0c89b09672e4 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; @@ -2035,21 +2034,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) { @@ -2057,14 +2041,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 dca22de98d94..d211da0763b7 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -80,7 +80,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