From patchwork Sun Sep 1 05:26:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2852463 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE7D2C0AD3 for ; Sun, 1 Sep 2013 05:26:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35C4B20371 for ; Sun, 1 Sep 2013 05:26:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 516BE20397 for ; Sun, 1 Sep 2013 05:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755295Ab3IAF0T (ORCPT ); Sun, 1 Sep 2013 01:26:19 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:39384 "EHLO mail-pb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754859Ab3IAF0O (ORCPT ); Sun, 1 Sep 2013 01:26:14 -0400 Received: by mail-pb0-f45.google.com with SMTP id mc17so3463068pbc.32 for ; Sat, 31 Aug 2013 22:26:12 -0700 (PDT) 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; bh=m9jvj0tv5UfSRFKIc56Iy+LMSMUCmiO+rJn6rwtdjzs=; b=jXJmc02qfMDhtxbesnoyaQSshDVmrKw3Ac4l+frIwUi5VFWedfBCvXhoYkZkAt9C0R Ks81DKAxYevVVfzxmvcT//IyySQU+/VbJq1PU7TZhCi4B/TIBPM8N7EF71CLeKpDhq5I Z89zrHL69Dc1w7By6fSVIui9mdZJa4Bad/WhxK8IETsItf5vREySFrzPukMXp70TYvcp 2+LCzBWc0wjyGvZJc7seMMVnvmpU1T1UL6t3EN9PYtQqAaDHPUQig8OFIh/Vnn5X9r7d AmVJuW30ERT8k9bqrxxZwdWY4DzrjZbukqBgZKaxJPI8pnrI6by15dNg6WaKRB5tN5He +oUg== X-Gm-Message-State: ALoCoQmAdhoaPLN1wClbQjr07boHSkBTXbiGGT5uEkRkinNpTob1HJKswZ1pxgEyElEN9PgM1rrH X-Received: by 10.66.217.166 with SMTP id oz6mr19745027pac.22.1378013170892; Sat, 31 Aug 2013 22:26:10 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id yg3sm8448012pab.16.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 31 Aug 2013 22:26:09 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl, sboyd@codeaurora.org Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH 1/2] cpufreq: don't allow governor limits to be changed when it is disabled Date: Sun, 1 Sep 2013 10:56:01 +0530 Message-Id: <085013f4e584e3fef97187bcb349c3fa76942e19.1378012620.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 __cpufreq_governor() returns with -EBUSY when governor is already stopped and we try to stop it again, but when it is stopped we must not allow calls to CPUFREQ_GOV_LIMITS event as well. This patch adds this check in __cpufreq_governor(). Signed-off-by: Viresh Kumar --- Hi Rafael, Its better if we can get these in for 3.11, otherwise we need to get them in the stable tree.. Anyway, we will get these in 3.10 stable tree but that requires us to identify few more patches that will go with these. I will do that later. This must fix the issues reported by Stephen. Tested on my thinkpad over your linux-next branch. drivers/cpufreq/cpufreq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 5c75e31..f320a20 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1692,8 +1692,9 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, policy->cpu, event); mutex_lock(&cpufreq_governor_lock); - if ((!policy->governor_enabled && (event == CPUFREQ_GOV_STOP)) || - (policy->governor_enabled && (event == CPUFREQ_GOV_START))) { + 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; }