From patchwork Sat Nov 30 15:56:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21902 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 89B4B20DB9 for ; Sat, 30 Nov 2013 15:56:36 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id v10sf27762976pde.4 for ; Sat, 30 Nov 2013 07:56:35 -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=qy8tMVLvhem0N8wsJTOf3R5R86Itg0zjS+qHQeLxCTQ=; b=Z0v5c6pFumk+6kG7os1q2jhNHFn/V9nVLCgOkihV1snEu7lC1o/ezu1sZIJydU58wy gIDMGLtcXseM4hbociElHpgEr3fbl4T2RxMWMoyDFvnChmT9DqRlLIoyu6BpxSBwO24V EgUvYinFr2DRJ/sE/bH6VTu/N8kQ6gFp3Dt/X2hb07hoefoK9D7ckS1+Ti4elxU9wvGX EdmZ+D+9ddo9oU3ZoAYtU7YjuI60BphXZUDvunJjlRCEZ5tWCtMnrWFn2VxQtQXM/3r5 xswb77EwmdlFEWT8imoizZUls0iRhQK0RAG0DWmUsLtYxeOw9u0f1eYTI9dKoNOAsoKX OOvw== X-Gm-Message-State: ALoCoQlSSyNneHPSFg1nUJoirbLwg16k3ZNMNZjr04fCi7jxN6viX6xk3QGC32HfTrRL4Bfvtb31 X-Received: by 10.68.196.228 with SMTP id ip4mr7314332pbc.5.1385826995145; Sat, 30 Nov 2013 07:56:35 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.105 with SMTP id j9ls4366605qej.94.gmail; Sat, 30 Nov 2013 07:56:35 -0800 (PST) X-Received: by 10.52.98.194 with SMTP id ek2mr38510932vdb.11.1385826994990; Sat, 30 Nov 2013 07:56:34 -0800 (PST) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id ta5si26551446veb.145.2013.11.30.07.56.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 30 Nov 2013 07:56:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so7497954veb.26 for ; Sat, 30 Nov 2013 07:56:34 -0800 (PST) X-Received: by 10.52.162.168 with SMTP id yb8mr4118209vdb.8.1385826994024; Sat, 30 Nov 2013 07:56:34 -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 u4csp3794vcz; Sat, 30 Nov 2013 07:56:33 -0800 (PST) X-Received: by 10.66.170.138 with SMTP id am10mr57000273pac.51.1385826993156; Sat, 30 Nov 2013 07:56:33 -0800 (PST) Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) by mx.google.com with ESMTPS id ya10si6336017pab.240.2013.11.30.07.56.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 30 Nov 2013 07:56:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.47 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.160.47; Received: by mail-pb0-f47.google.com with SMTP id um1so16000142pbc.6 for ; Sat, 30 Nov 2013 07:56:32 -0800 (PST) X-Received: by 10.66.148.97 with SMTP id tr1mr1968689pab.163.1385826991749; Sat, 30 Nov 2013 07:56:31 -0800 (PST) Received: from localhost ([122.167.133.207]) by mx.google.com with ESMTPSA id iu7sm109899517pbc.45.2013.11.30.07.56.28 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 30 Nov 2013 07:56:31 -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 1/5] cpufreq: Introduce cpufreq_notify_post_transition() Date: Sat, 30 Nov 2013 21:26:19 +0530 Message-Id: <0d635c6701654a75f6d25dd435705dc1ede3e19c.1385826776.git.viresh.kumar@linaro.org> 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.128.181 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 in case of failures. This is useful at multiple places, specially for sending transition failure notifications. Signed-off-by: Viresh Kumar --- Hi Rafael, Please see if you want to take it for 3.13 or 14, as this fixes bugs which are partly introduced in 3.13.. 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 606224a..a862aa9 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -324,6 +324,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 ee5fe9d..57e48db 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -314,6 +314,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,