From patchwork Mon Dec 30 05:58:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 3417641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3E5E49F374 for ; Mon, 30 Dec 2013 06:05:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 65044200F3 for ; Mon, 30 Dec 2013 06:05:07 +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 55D8E200F2 for ; Mon, 30 Dec 2013 06:05:06 +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 1VxVyI-0000Pf-AV; Mon, 30 Dec 2013 06:05:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VxVyG-0000oB-0I; Mon, 30 Dec 2013 06:05:00 +0000 Received: from mail-ig0-f181.google.com ([209.85.213.181]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VxVyD-0000nZ-1r for linux-arm-kernel@lists.infradead.org; Mon, 30 Dec 2013 06:04:57 +0000 Received: by mail-ig0-f181.google.com with SMTP id k19so26727064igc.2 for ; Sun, 29 Dec 2013 22:04: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:from:to:cc:subject:date:message-id; bh=vKn58QtmXS7VcxEkX+cp5AYr41Ewlllp+uNofvPpEtc=; b=akr7EiQOpCFfPuR9h8A6FpigByrt/r546ZIPKJqf/+/kSdnEh3APrcFFELCjybIVLQ 3oxmssYkT+lXZASHkmsj1Vcb7C08ek0joIIdxf9lJAVgXhDX0iBg5E3UKYScPXuR79Yi DRmkCVMDvtT+VbTv7bI9Bk9YF5yXx30vax7HhoN5HxIYLaWnu8jdOtiVrBBB7Fht6G0F LdE6wWjp4VSYnB+HA7RF9z4alD8XnddggOqtQ8eNli9Z3uDHCdEkfc8R/XurxqH4aVAF ncE8b5EYPALS+QGZ/auxr+bVx4YAigoxtWsMb99YkWTNqlFe0AzQGyquTd4aTvLHpc1L 0Ieg== X-Gm-Message-State: ALoCoQn4weBxe6FERhLagX1PUPrDIhjN46syYUGsbcgeeQvVNbSF+8o0GZKeZnerPdxGkTL2PzuM X-Received: by 10.42.66.134 with SMTP id p6mr100018ici.85.1388383129831; Sun, 29 Dec 2013 21:58:49 -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 kb10sm56333433igb.6.2013.12.29.21.58.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Dec 2013 21:58:49 -0800 (PST) From: Alex Elder To: mike.turquette@linaro.org Subject: [PATCH] clk: support hardware-specific debugfs entries Date: Sun, 29 Dec 2013 23:58:50 -0600 Message-Id: <1388383130-8029-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-20131230_010457_138809_D3B1AB4B X-CRM114-Status: GOOD ( 12.42 ) 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.6 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 2cf2ea6..c82a1bc 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -268,6 +268,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 7e59253..76ba2b2 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -31,6 +31,7 @@ #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */ struct clk_hw; +struct dentry; /** * struct clk_ops - Callback operations for hardware clocks; these are to @@ -108,6 +109,12 @@ struct clk_hw; * which is likely helpful for most .set_rate implementation. * Returns 0 on success, -EERROR otherwise. * + * @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, @@ -140,6 +147,7 @@ struct clk_ops { int (*set_rate)(struct clk_hw *hw, unsigned long, unsigned long); void (*init)(struct clk_hw *hw); + int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); }; /**