From patchwork Tue Jan 27 08:36:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 43824 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EC1162409D for ; Tue, 27 Jan 2015 08:37:30 +0000 (UTC) Received: by mail-we0-f197.google.com with SMTP id l61sf6814034wev.0 for ; Tue, 27 Jan 2015 00:37:30 -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=dksGJkCnAf1XZZFGpMjmuxLIH2ygbKjfQs2ugiWNVC0=; b=XP6aboE9SjBFi0zoezS/Bng6Y0R9OZp3AJ3oQEKvVqRPhUe89OBGPVMMJsn06sv2Mn EyO78rObcKXJMEzf6n3z79lF8TzigxNPUDGdt10Xj5a1y/RbopYhLYkByMAnBMRSFJXA ++5ZYCSb6ZIaOhCJ4cs81YaDjqyq7WkpINAsb8Y3V9vY1Cpitd+7+QT3uw/7y6sFfmBa 3NwrX5C6EvlpV3ouemdCy+Wvk0ZN5/cXVJkqP+gtCSX4hkMIuNYmYi3i5eixXlNCS+Jw cDwstnunHq0ZXX5MOBHkoHUjChpJyrXbQTVUr5WjDoUX/56/RXM9fVqYP3w5eJIlSidq ztHA== X-Gm-Message-State: ALoCoQmA/sWrzQbPks/TF8TEP00WCX8BLyibgNBmErhWcLeowVqRbPEHhvxvHtbjP2mfFL8ad35K X-Received: by 10.152.43.166 with SMTP id x6mr28960lal.3.1422347850278; Tue, 27 Jan 2015 00:37:30 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.193 with SMTP id ao1ls4848lac.20.gmail; Tue, 27 Jan 2015 00:37:29 -0800 (PST) X-Received: by 10.112.235.67 with SMTP id uk3mr177482lbc.48.1422347849928; Tue, 27 Jan 2015 00:37:29 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id k1si575746lam.30.2015.01.27.00.37.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 00:37:29 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id b6so11777449lbj.11 for ; Tue, 27 Jan 2015 00:37:29 -0800 (PST) X-Received: by 10.152.182.235 with SMTP id eh11mr113301lac.9.1422347849795; Tue, 27 Jan 2015 00:37:29 -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 h5csp1025551lbj; Tue, 27 Jan 2015 00:37:29 -0800 (PST) X-Received: by 10.66.118.109 with SMTP id kl13mr62251pab.19.1422347848069; Tue, 27 Jan 2015 00:37:28 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si627522pdk.182.2015.01.27.00.37.27; Tue, 27 Jan 2015 00:37:28 -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 S1757910AbbA0IhS (ORCPT + 11 others); Tue, 27 Jan 2015 03:37:18 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:56943 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757898AbbA0IhP (ORCPT ); Tue, 27 Jan 2015 03:37:15 -0500 Received: by mail-pa0-f51.google.com with SMTP id fb1so17156883pad.10 for ; Tue, 27 Jan 2015 00:37:15 -0800 (PST) X-Received: by 10.66.249.99 with SMTP id yt3mr150pac.59.1422347834865; Tue, 27 Jan 2015 00:37:14 -0800 (PST) Received: from localhost ([122.178.198.250]) by mx.google.com with ESMTPSA id fm4sm775703pdb.88.2015.01.27.00.37.13 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 27 Jan 2015 00:37:14 -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 09/18] cpufreq: Mark policy->governor = NULL for fallback policies Date: Tue, 27 Jan 2015 14:06:15 +0530 Message-Id: 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.180 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 21c8ef6073d7..ed36c09f83cc 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1032,9 +1032,6 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) } read_unlock_irqrestore(&cpufreq_driver_lock, flags); - if (policy) - policy->governor = NULL; - return policy; } @@ -1466,6 +1463,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)