From patchwork Sat Jan 11 19:10:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 3469621 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3B72CC02DC for ; Sat, 11 Jan 2014 19:16:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6893920170 for ; Sat, 11 Jan 2014 19:16:37 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73A0820165 for ; Sat, 11 Jan 2014 19:16:36 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W242m-0007Hs-PD; Sat, 11 Jan 2014 19:16:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W242k-00008Z-AF; Sat, 11 Jan 2014 19:16:26 +0000 Received: from mail-ie0-f176.google.com ([209.85.223.176]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W242e-00008A-Qs for linux-arm-kernel@lists.infradead.org; Sat, 11 Jan 2014 19:16:23 +0000 Received: by mail-ie0-f176.google.com with SMTP id at1so6377664iec.7 for ; Sat, 11 Jan 2014 11:15:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+2g4TDA/vzXn5PBbA5d+DpaofeJd9g17gx8anwV2Lv0=; b=j9j4VXVz4CUmkXd5FXsZ+oAeFKTjhyvvKM91vw0TcwwRAKrkExQNTTMD0spUKtBJdc fRdhccBbhq5UCHnAYpk7bDhWww25zXQDrDaM70V2AKqwCK00BjoVm/eyVfqP+d0mUYwG i3C2evllob7Hf5pepu6eaBXwJ3FCqlgpwYdTNJTCnG/3Bsv7gASNQZBBSUlsv5z/AQAp lSACa9hu61MIj7qkM3ULakKWdo2YNHc5hfvzOLL6KjkZYzruUOP9n1F3Xbh5AiMW6xp3 Xrg+J9KDsSQqBkMq5GziQwmxdHTHYJ4ZK4YsIBHypI1WKf8jg8hDMGeZR0W3TVczH1Zw fofQ== X-Gm-Message-State: ALoCoQlmjw7swMXAWvS3uR4/zsulXOkdVcWQZx4MjlI8VvSB+Vo2K7eM8T2qkA+tZKbKsx2z5qSN X-Received: by 10.43.71.200 with SMTP id yl8mr14208icb.74.1389467410109; Sat, 11 Jan 2014 11:10:10 -0800 (PST) Received: from localhost.localdomain (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id u1sm9287723ige.1.2014.01.11.11.10.09 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 11 Jan 2014 11:10:09 -0800 (PST) From: Alex Elder To: mike.turquette@linaro.org Subject: [PATCH v2 RESEND] clk: support hardware-specific debugfs entries Date: Sat, 11 Jan 2014 13:10:04 -0600 Message-Id: <1389467404-1287-1-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140111_141620_906230_3B2AD4A5 X-CRM114-Status: GOOD ( 13.07 ) X-Spam-Score: -2.6 (--) Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a new clk_ops->debug_init method to allow a clock hardware driver to populate the clock's debugfs directory with entries beyond those common for every clock. Signed-off-by: Alex Elder --- v2: - Define debug_init unconditionally (suggested by Gerhard Sittig). drivers/clk/clk.c | 4 ++++ include/linux/clk-provider.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index e3e0327..8769b01 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -277,6 +277,10 @@ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry) if (!d) goto err_out; + if (clk->ops->debug_init) + if (clk->ops->debug_init(clk->hw, clk->dentry)) + goto err_out; + ret = 0; goto out; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 5429f5d..b91674d 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -32,6 +32,7 @@ #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ struct clk_hw; +struct dentry; /** * struct clk_ops - Callback operations for hardware clocks; these are to @@ -116,6 +117,12 @@ struct clk_hw; * set then clock accuracy will be initialized to parent accuracy * or 0 (perfect clock) if clock has no parent. * + * @debug_init: Set up type-specific debugfs entries for this clock. This + * is called once, after the debugfs directory entry for this + * clock has been created. The dentry pointer representing that + * directory is provided as an argument. Called with + * prepare_lock held. Returns 0 on success, -EERROR otherwise. + * * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow * implementations to split any work between atomic (enable) and sleepable * (prepare) contexts. If enabling a clock requires code that might sleep, @@ -150,6 +157,7 @@ struct clk_ops { unsigned long (*recalc_accuracy)(struct clk_hw *hw, unsigned long parent_accuracy); void (*init)(struct clk_hw *hw); + int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); }; /**