From patchwork Thu Feb 19 11:32: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: 44835 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9A39F21554 for ; Thu, 19 Feb 2015 11:35:05 +0000 (UTC) Received: by labgm9 with SMTP id gm9sf4672422lab.2 for ; Thu, 19 Feb 2015 03:35:04 -0800 (PST) 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=1tTI8niEvMsoSD0XAjfNRECh1AV4f0TcydTZxqRRxPQ=; b=PGLionvXs3puUGVi0YNlWNzEIvEY2Ha23xTb5UpHhqQOSV44d0v62PAf7MwRP/1PWQ nl89rWBswGlFl0r57K+JQIJnhXeHXUf3kbUJsaDyoM8uLDaZPFZy1f/RxZFvtHjdjjLp LFIOIe6rJUpCjcznFXOmgWefpq7FAR2x93kpazU+xkrdwNRz+Qm4a5Rt0S63mVjuhI2v RaLaD0RoKNnAGwASbHv+wxYJEf1olw+S0U/p7HHjnVRknX9QcTfYZyxox3fo0Q9OQqEX PCrUBe0EwnMmfymIXxmTZ1G//pRe9RcDXG+9jyKukmsDetxea/F8Ane+hAwNNjNqT8Z6 VyFg== X-Gm-Message-State: ALoCoQnZA/onFdlBP7RUl+iiUxPmEiQ7LAXLHHbtQTeoBMyk3Ad1G3L6XncXRF+MUs2p9TLqHTVb X-Received: by 10.112.162.135 with SMTP id ya7mr517699lbb.14.1424345704685; Thu, 19 Feb 2015 03:35:04 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.139 with SMTP id dg11ls84456lac.62.gmail; Thu, 19 Feb 2015 03:35:04 -0800 (PST) X-Received: by 10.112.110.231 with SMTP id id7mr1631758lbb.28.1424345704531; Thu, 19 Feb 2015 03:35:04 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id g7si14618909lbl.20.2015.02.19.03.35.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Feb 2015 03:35:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbiw7 with SMTP id w7so6810875lbi.10 for ; Thu, 19 Feb 2015 03:35:04 -0800 (PST) X-Received: by 10.112.42.225 with SMTP id r1mr90973lbl.72.1424345704453; Thu, 19 Feb 2015 03:35:04 -0800 (PST) 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.35.133 with SMTP id h5csp432166lbj; Thu, 19 Feb 2015 03:35:03 -0800 (PST) X-Received: by 10.66.66.75 with SMTP id d11mr6486047pat.147.1424345701833; Thu, 19 Feb 2015 03:35:01 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u14si364614pdi.41.2015.02.19.03.35.00; Thu, 19 Feb 2015 03:35:01 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752574AbbBSLe7 (ORCPT + 11 others); Thu, 19 Feb 2015 06:34:59 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:42270 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753423AbbBSLeI (ORCPT ); Thu, 19 Feb 2015 06:34:08 -0500 Received: by padhz1 with SMTP id hz1so8833229pad.9 for ; Thu, 19 Feb 2015 03:34:08 -0800 (PST) X-Received: by 10.68.241.102 with SMTP id wh6mr7079182pbc.18.1424345648229; Thu, 19 Feb 2015 03:34:08 -0800 (PST) Received: from localhost ([122.172.249.58]) by mx.google.com with ESMTPSA id qm12sm23562823pdb.36.2015.02.19.03.34.07 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 19 Feb 2015 03:34:07 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, sboyd@codeaurora.org, prarit@redhat.com, skannan@codeaurora.org, Viresh Kumar Subject: [PATCH V2 12/20] cpufreq: Mark policy->governor = NULL for inactive policies Date: Thu, 19 Feb 2015 17:02:14 +0530 Message-Id: <466c5246b6ad83b960eeb63ab34a04379448980d.1424345053.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.3.0.rc0.44.ga94655d In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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.179 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: , Later commits would change the way policies are managed today. Policies wouldn't be freed on cpu hotplug (currently they aren't freed on suspend), and while the CPU is offline, the sysfs cpufreq files would still be present. Because we don't mark policy->governor as NULL, it still contains pointer of the last governor it used. And when we read the 'scaling_governor' file, it shows the old value. To prevent from this, mark policy->governor as NULL after we have issued CPUFREQ_GOV_POLICY_EXIT event for its governor. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index b7cd1bf97044..cab4cfdd3ebb 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1094,7 +1094,6 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) if (likely(policy)) { /* Policy should be inactive here */ WARN_ON(!policy_is_inactive(policy)); - policy->governor = NULL; } return policy; @@ -1497,6 +1496,8 @@ static int __cpufreq_remove_dev_finish(struct device *dev, if (!cpufreq_suspended) cpufreq_policy_free(policy); + else + policy->governor = NULL; } else if (has_target()) { ret = __cpufreq_governor(policy, CPUFREQ_GOV_START); if (!ret)