From patchwork Wed Jan 22 19:48:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Soren Brinkmann X-Patchwork-Id: 313392 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A9DBE2C0082 for ; Thu, 23 Jan 2014 06:49:22 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W63nT-0003C2-Fb; Wed, 22 Jan 2014 19:49:11 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W63nQ-00022V-Jb; Wed, 22 Jan 2014 19:49:08 +0000 Received: from mail-qc0-x229.google.com ([2607:f8b0:400d:c01::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W63nN-00020q-6S for linux-arm-kernel@lists.infradead.org; Wed, 22 Jan 2014 19:49:05 +0000 Received: by mail-qc0-f169.google.com with SMTP id w7so1188864qcr.14 for ; Wed, 22 Jan 2014 11:48:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=estsu8fhmci3ScuTWp3p7XS7ZpRg8Zx5C/k7uiLpLck=; b=q8Wm02v71TbcFLcEQgobYSuO8LZkHPjlIX7T1VKbrJ7VyZPa9TkWJmZUVPr1ioXV2l pwlQ116NIkrZnt9F4L6/jpg3pTr7bk0CXN9F5N74WPujlc76vs9i9O0yWnre0BHg3JlH 4M81q1p05Ygz8dszsB5FOf/cFUuKya61Rt/WK1Vvhom+LyX1r8+99TRDc9DlZp80PTZS 91LeMelF7+5qz0mXIacwGUz08f6jFGQQwcwZ+nmW07YBJF54lQ1jvZlltUGgOL8tzLWn es0hufXuWhEuJ+BahSCHRg67bucjfYwcH9YstNT0JG6RJbrI1Lgzl025KJXHLCc4PugE tTAQ== X-Received: by 10.140.88.112 with SMTP id s103mr5184140qgd.47.1390420121843; Wed, 22 Jan 2014 11:48:41 -0800 (PST) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id j97sm5597499qge.22.2014.01.22.11.48.40 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 22 Jan 2014 11:48:41 -0800 (PST) From: Soren Brinkmann To: Mike Turquette , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] clk: Fix notifier documentation Date: Wed, 22 Jan 2014 11:48:37 -0800 Message-Id: <1390420117-25930-1-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 1.8.5.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140122_144905_275249_6356FF55 X-CRM114-Status: GOOD ( 13.33 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (soeren.brinkmann[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Soren Brinkmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Contradicting to documenation, the notifier callbacks do receive the original clock rate in struct clk_notifier_data.old_rate and the new frequency struct clk_notifier_data.new_rate, independent of the notification reason. This behavior also seems to make more sense, since callbacks can use the same code to deterimine whether clocks are scaled up or down. Something which would not even possible in the post-rate-change case if the behavior was as documented. Signed-off-by: Soren Brinkmann --- Hi Mike, I am working with some clock notifiers and if my results are correct the notifiers behave differently from how they are documented. I think the actual behavior makes more sense than the documented and my original plan was to change the behavior, but it seems I might get away with a doc-update. Thanks, Sören drivers/clk/clk.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 2cf2ea6b77a1..26825db03e64 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1983,20 +1983,11 @@ EXPORT_SYMBOL_GPL(devm_clk_unregister); * re-enter into the clk framework by calling any top-level clk APIs; * this will cause a nested prepare_lock mutex. * - * Pre-change notifier callbacks will be passed the current, pre-change - * rate of the clk via struct clk_notifier_data.old_rate. The new, - * post-change rate of the clk is passed via struct + * In all notification cases cases (pre, post and abort rate change) the + * original clock rate is passed to the callback via struct + * clk_notifier_data.old_rate and the new frequency is passed via struct * clk_notifier_data.new_rate. * - * Post-change notifiers will pass the now-current, post-change rate of - * the clk in both struct clk_notifier_data.old_rate and struct - * clk_notifier_data.new_rate. - * - * Abort-change notifiers are effectively the opposite of pre-change - * notifiers: the original pre-change clk rate is passed in via struct - * clk_notifier_data.new_rate and the failed post-change rate is passed - * in via struct clk_notifier_data.old_rate. - * * clk_notifier_register() must be called from non-atomic context. * Returns -EINVAL if called with null arguments, -ENOMEM upon * allocation failure; otherwise, passes along the return value of