From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 12/12] arm/mxs: select HAVE_CLK_PREPARE for clock
Date: Tue, 20 Dec 2011 20:00:43 +0800 [thread overview]
Message-ID: <1324382443-4439-13-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1324382443-4439-1-git-send-email-shawn.guo@linaro.org>
This patch adds clk_prepare/clk_unprepare for mxs clock api by
renaming the existing non-atomic clk_enable/clk_disable to
clk_prepare/clk_unprepare and adding a pair of dummy
clk_enable/clk_disable. Then with selecting HAVE_CLK_PREPARE for
mxs clock, we can fix the mutex locking warning that has been
reported for a few times.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/Kconfig | 1 +
arch/arm/mach-mxs/clock.c | 31 ++++++++++++++++++++++---------
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 776d76b..dc46163 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -442,6 +442,7 @@ config ARCH_MXS
select ARCH_REQUIRE_GPIOLIB
select CLKDEV_LOOKUP
select CLKSRC_MMIO
+ select HAVE_CLK_PREPARE
help
Support for Freescale MXS-based family of processors
diff --git a/arch/arm/mach-mxs/clock.c b/arch/arm/mach-mxs/clock.c
index 755eec0..97a6f4a 100644
--- a/arch/arm/mach-mxs/clock.c
+++ b/arch/arm/mach-mxs/clock.c
@@ -74,10 +74,15 @@ static int __clk_enable(struct clk *clk)
return 0;
}
-/* This function increments the reference count on the clock and enables the
- * clock if not already enabled. The parent clock tree is recursively enabled
+/*
+ * The clk_enable/clk_disable could be called by drivers in atomic context,
+ * so they should not really hold mutex. Instead, clk_prepare/clk_unprepare
+ * can hold a mutex, as the pair will only be called in non-atomic context.
+ * Before migrating to common clk framework, we can have __clk_enable and
+ * __clk_disable called in clk_prepare/clk_unprepare with mutex held and
+ * leave clk_enable/clk_disable as the dummy functions.
*/
-int clk_enable(struct clk *clk)
+int clk_prepare(struct clk *clk)
{
int ret = 0;
@@ -90,13 +95,9 @@ int clk_enable(struct clk *clk)
return ret;
}
-EXPORT_SYMBOL(clk_enable);
+EXPORT_SYMBOL(clk_prepare);
-/* This function decrements the reference count on the clock and disables
- * the clock when reference count is 0. The parent clock tree is
- * recursively disabled
- */
-void clk_disable(struct clk *clk)
+void clk_unprepare(struct clk *clk)
{
if (clk == NULL || IS_ERR(clk))
return;
@@ -105,6 +106,18 @@ void clk_disable(struct clk *clk)
__clk_disable(clk);
mutex_unlock(&clocks_mutex);
}
+EXPORT_SYMBOL(clk_unprepare);
+
+int clk_enable(struct clk *clk)
+{
+ return 0;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+ /* nothing to do */
+}
EXPORT_SYMBOL(clk_disable);
/* Retrieve the *current* clock rate. If the clock itself
--
1.7.4.1
next prev parent reply other threads:[~2011-12-20 12:00 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-20 12:00 [PATCH 0/12] Add clk_prepare/clk_unprepare for mxs clock api Shawn Guo
2011-12-20 12:00 ` [PATCH 01/12] clk: add helper functions clk_prepare_enable and clk_disable_unprepare Shawn Guo
2011-12-20 13:48 ` Marek Vasut
2011-12-20 14:09 ` Shawn Guo
2011-12-20 12:00 ` [PATCH 02/12] arm/mxs: convert platform code to clk_prepare/clk_unprepare Shawn Guo
2011-12-20 13:44 ` Marek Vasut
2011-12-20 21:11 ` Russell King - ARM Linux
2011-12-20 21:28 ` Marek Vasut
2011-12-20 12:00 ` [PATCH 03/12] net: fec: add clk_prepare/clk_unprepare Shawn Guo
2011-12-20 13:45 ` Marek Vasut
2011-12-20 12:00 ` [PATCH 04/12] dma: mxs-dma: convert to clk_prepare/clk_unprepare Shawn Guo
2011-12-20 13:45 ` Marek Vasut
2011-12-23 17:35 ` Vinod Koul
2011-12-20 12:00 ` [PATCH 05/12] mmc: mxs-mmc: " Shawn Guo
2011-12-20 13:45 ` Marek Vasut
2011-12-20 12:00 ` [PATCH 06/12] mtd: gpmi-lib: " Shawn Guo
2011-12-20 13:46 ` Marek Vasut
2011-12-20 12:00 ` [PATCH 07/12] net: flexcan: " Shawn Guo
2011-12-20 13:48 ` Marek Vasut
2011-12-20 14:23 ` Shawn Guo
2011-12-20 12:00 ` [PATCH 08/12] serial: mxs-auart: " Shawn Guo
2011-12-20 13:49 ` Marek Vasut
2011-12-20 14:07 ` Uwe Kleine-König
2011-12-20 21:15 ` Russell King - ARM Linux
2011-12-20 21:28 ` Marek Vasut
2011-12-20 22:24 ` Russell King - ARM Linux
2011-12-21 1:06 ` Marek Vasut
2011-12-20 14:27 ` Shawn Guo
2011-12-20 12:00 ` [PATCH 09/12] video: mxsfb: " Shawn Guo
2011-12-20 13:49 ` Marek Vasut
2011-12-21 2:11 ` Florian Tobias Schandinat
2011-12-20 12:00 ` [PATCH 10/12] ASoC: mxs-saif: " Shawn Guo
2011-12-20 11:55 ` Mark Brown
2011-12-20 13:49 ` Marek Vasut
2011-12-20 12:00 ` [PATCH 11/12] clk: add config option HAVE_CLK_PREPARE into Kconfig Shawn Guo
2011-12-20 12:00 ` Shawn Guo [this message]
2011-12-20 13:43 ` [PATCH 0/12] Add clk_prepare/clk_unprepare for mxs clock api Marek Vasut
2011-12-20 14:05 ` Shawn Guo
2011-12-20 13:59 ` Marek Vasut
2011-12-20 14:21 ` Shawn Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1324382443-4439-13-git-send-email-shawn.guo@linaro.org \
--to=shawn.guo@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).