From patchwork Mon Feb 22 11:06:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 62555 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1158035lbl; Mon, 22 Feb 2016 03:07:26 -0800 (PST) X-Received: by 10.98.80.10 with SMTP id e10mr17594105pfb.141.1456139246352; Mon, 22 Feb 2016 03:07:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si39140922pfa.79.2016.02.22.03.07.26; Mon, 22 Feb 2016 03:07:26 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754536AbcBVLHU (ORCPT + 30 others); Mon, 22 Feb 2016 06:07:20 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:32969 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754506AbcBVLHO (ORCPT ); Mon, 22 Feb 2016 06:07:14 -0500 Received: by mail-pa0-f52.google.com with SMTP id fl4so89758913pad.0 for ; Mon, 22 Feb 2016 03:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=UqMK2pGytIwgThZOjnYxwwSqiXl6JMhe3OIcAWhpBnM=; b=hz7fYCULvL8KfnOIzi2N6Anu1I1nXLQPt+giscY9u1sKj0nXxr7hlnvJR87ic0Ah3N 6WuXYIKhtjNEOSIrzeADGYMAsG3Jhcz717BDHDoI+j8b2Bsht3jHrM9LRA3z/+hiWjcx H9cz1R5XxGhF8ZPnXz3BLOOK4ZEB6hkqrlyhc= 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=UqMK2pGytIwgThZOjnYxwwSqiXl6JMhe3OIcAWhpBnM=; b=Y5dfSd59MNdClI+7N3nySfYZR2uMxmuAZnlVmKyssjySZZizjM/w68U7d0nsMXmkpO Z7RS4wpRFyM5hv5kkOqIgplRj9l9bvUlCA+RRBivxGmafTeESOizSFpjZLTe9+RAMnCu bHqpuxo4XHlj6ejGw59MejO0IADwJCDkyYxxArkW+9kJG5Jc/io+WczZWDRQs5qrc+pt /EmJbUqNimurGkc/gtkFm1VROkojRFymcvtd19MRAZkeXCXh7KY9FCcCHZ/bhOBRmy5n dvE4abjTSitClxL3SKvSdllVJZR7yeHtaRhp12D6fII3bily2XQNLBWE5u7khAOIjlE1 xApg== X-Gm-Message-State: AG10YOTmyl0UrM2rDP9RTrhrloEQR/xwoREXd+Hujyg8iYuMzPnvoLBfbu5bx3VrIhm0N1vV X-Received: by 10.66.191.202 with SMTP id ha10mr37377685pac.8.1456139233776; Mon, 22 Feb 2016 03:07:13 -0800 (PST) Received: from localhost ([122.172.89.184]) by smtp.gmail.com with ESMTPSA id dg1sm36250249pad.18.2016.02.22.03.07.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 03:07:13 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] cpufreq: Remove 'policy->governor_enabled' Date: Mon, 22 Feb 2016 16:36:44 +0530 Message-Id: <71eb1afbbf5001f978d6a610fd298900d1953f91.1456139127.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The entire sequence of events (like INIT/START or STOP/EXIT) for which cpufreq_governor() is called, is guaranteed to be protected by policy->rwsem now. The additional checks that were added earlier (as we were forced to drop policy->rwsem before calling cpufreq_governor() for EXIT event), aren't required anymore. Over that, they weren't sufficient really. They just take care of START/STOP events, but not INIT/EXIT and the state machine was never maintained properly by them. Kill the unnecessary checks and policy->governor_enabled field. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 17 ----------------- include/linux/cpufreq.h | 1 - 2 files changed, 18 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index fa070bf87dd8..8259e8215bc1 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1961,17 +1961,6 @@ static int cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) pr_debug("%s: for CPU %u, event %u\n", __func__, policy->cpu, event); - if ((policy->governor_enabled && event == CPUFREQ_GOV_START) - || (!policy->governor_enabled - && (event == CPUFREQ_GOV_LIMITS || event == CPUFREQ_GOV_STOP))) { - return -EBUSY; - } - - if (event == CPUFREQ_GOV_STOP) - policy->governor_enabled = false; - else if (event == CPUFREQ_GOV_START) - policy->governor_enabled = true; - ret = policy->governor->governor(policy, event); if (!ret) { @@ -1979,12 +1968,6 @@ static int cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) policy->governor->initialized++; else if (event == CPUFREQ_GOV_POLICY_EXIT) policy->governor->initialized--; - } else { - /* Restore original values */ - if (event == CPUFREQ_GOV_STOP) - policy->governor_enabled = true; - else if (event == CPUFREQ_GOV_START) - policy->governor_enabled = false; } if (((event == CPUFREQ_GOV_POLICY_INIT) && ret) || diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index cac3d1ba8200..a50c5b2e3bf2 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -80,7 +80,6 @@ struct cpufreq_policy { unsigned int last_policy; /* policy before unplug */ 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