From patchwork Mon Dec 2 05:34:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21907 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 68EFC20DB9 for ; Mon, 2 Dec 2013 05:34:24 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id o6sf41293089oag.7 for ; Sun, 01 Dec 2013 21:34:23 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=pGsflyxL5ev/eYBfzUf1pKtPt+b2BMFxXcp1jnoX5jg=; b=dpMJ9fEZxG+LCaO1ex2GSMI6pfKH1CyADZGOALZiqt0nP9MpgEvRXV/z5mRGQf0WZs 1ShVRGYOqAWzv/x7UPVFUl0FRJmGBH6accVDLm3CTpV5AsFYPr8fS6ZRo/VOqgAD1+UB eVx6GK4Tu70saJPwVCXLFxa35f1QTk9hwpzdVO4qFz+KQPj7jcYSZcPh5QrxmL1w4gED LQ+byGCZuLsqG4rxqq678EA9fAwxb5Nx5PfAeIb0rDRdjOmyzMeDmx3bxTqkVkkxPsis QXchfDLGF9SSExWAmH2x5GHvpZPCJyOBpnHRzpSmXUdu8zFcMpCL1f+SPnvcikcuiJFs ihdQ== X-Gm-Message-State: ALoCoQmKk6rB2T+Nrdo7GXeXw/Sgo+o5exLrzRzgOZjLS6V2bloHc5mY9P8IoZVrbZ20IeitCfS7 X-Received: by 10.182.158.4 with SMTP id wq4mr21502271obb.18.1385962463266; Sun, 01 Dec 2013 21:34:23 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.128.200 with SMTP id nq8ls4503799qeb.95.gmail; Sun, 01 Dec 2013 21:34:23 -0800 (PST) X-Received: by 10.220.145.75 with SMTP id c11mr148698vcv.30.1385962463138; Sun, 01 Dec 2013 21:34:23 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id dq5si15407768vcb.99.2013.12.01.21.34.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 01 Dec 2013 21:34:22 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id if17so7917854vcb.39 for ; Sun, 01 Dec 2013 21:34:22 -0800 (PST) X-Received: by 10.58.46.18 with SMTP id r18mr51750172vem.4.1385962462835; Sun, 01 Dec 2013 21:34:22 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp91864vcz; Sun, 1 Dec 2013 21:34:22 -0800 (PST) X-Received: by 10.49.15.202 with SMTP id z10mr88580924qec.46.1385962462107; Sun, 01 Dec 2013 21:34:22 -0800 (PST) Received: from mail-qa0-f50.google.com (mail-qa0-f50.google.com [209.85.216.50]) by mx.google.com with ESMTPS id a3si12228091qcq.52.2013.12.01.21.34.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 01 Dec 2013 21:34:21 -0800 (PST) Received-SPF: neutral (google.com: 209.85.216.50 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.216.50; Received: by mail-qa0-f50.google.com with SMTP id i13so3986067qae.16 for ; Sun, 01 Dec 2013 21:34:21 -0800 (PST) X-Received: by 10.224.16.80 with SMTP id n16mr58368763qaa.42.1385962461668; Sun, 01 Dec 2013 21:34:21 -0800 (PST) Received: from localhost (git.linaro.org. [54.235.93.228]) by mx.google.com with ESMTPSA id p20sm151054033qay.0.2013.12.01.21.34.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 01 Dec 2013 21:34:21 -0800 (PST) From: Viresh Kumar To: rjw@rjwysocki.net 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 V2 1/5] cpufreq: Introduce cpufreq_notify_post_transition() Date: Mon, 2 Dec 2013 11:04:12 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This introduces another routine cpufreq_notify_post_transition() which can be used to send POSTCHANGE notification for new freq with or without both {PRE|POST}CHANGE notifications for last freq. This is useful at multiple places, specially for sending transition failure notifications. Signed-off-by: Viresh Kumar --- V1->V2: - Not required to push it for 3.13 anymore and can go in 3.14. - Rebased over following patchset as there were conflicts in unicore2 driver if following patchset is applied first (which should be the case): https://lkml.org/lkml/2013/10/30/553 (create cpufreq_generic_get() routine) drivers/cpufreq/cpufreq.c | 14 ++++++++++++++ include/linux/cpufreq.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 5e27def..3b877d4 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -338,6 +338,20 @@ void cpufreq_notify_transition(struct cpufreq_policy *policy, } EXPORT_SYMBOL_GPL(cpufreq_notify_transition); +/* Do post notifications when there are chances that transition has failed */ +void cpufreq_notify_post_transition(struct cpufreq_policy *policy, + struct cpufreq_freqs *freqs, int transition_failed) +{ + cpufreq_notify_transition(policy, freqs, CPUFREQ_POSTCHANGE); + if (!transition_failed) + return; + + swap(freqs->old, freqs->new); + cpufreq_notify_transition(policy, freqs, CPUFREQ_PRECHANGE); + cpufreq_notify_transition(policy, freqs, CPUFREQ_POSTCHANGE); +} +EXPORT_SYMBOL_GPL(cpufreq_notify_post_transition); + /********************************************************************* * SYSFS INTERFACE * diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 276e646..b26bfab 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -316,6 +316,8 @@ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); void cpufreq_notify_transition(struct cpufreq_policy *policy, struct cpufreq_freqs *freqs, unsigned int state); +void cpufreq_notify_post_transition(struct cpufreq_policy *policy, + struct cpufreq_freqs *freqs, int transition_failed); #else /* CONFIG_CPU_FREQ */ static inline int cpufreq_register_notifier(struct notifier_block *nb,