linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: linux-omap@vger.kernel.org
Subject: [PATCH 3/5] OMAP: hwmod: add option for no locking in idle/enable paths
Date: Thu, 27 May 2010 14:13:34 -0700	[thread overview]
Message-ID: <1274994816-30335-4-git-send-email-khilman@deeprootsystems.com> (raw)
In-Reply-To: <1274994816-30335-1-git-send-email-khilman@deeprootsystems.com>

Some hwmods may be idled/enabled directly from within the core
idle/suspend path.  Since interrupts are already disabled here,
the mutex-based locking in hwmod can sleep and will cause
potential deadlocks.

To fix, add a hwmod flag HWMOD_NO_IDLE_LOCKING which indicates to the
hwmod core that no locking should be done during the idle/enable
paths for this hwmod.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/mach-omap2/omap_hwmod.c             |   16 ++++++++++++----
 arch/arm/plat-omap/include/plat/omap_hwmod.h |    1 +
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 77fef90..1ee2fb2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1304,9 +1304,13 @@ int omap_hwmod_enable(struct omap_hwmod *oh)
 	if (!oh)
 		return -EINVAL;
 
-	mutex_lock(&omap_hwmod_mutex);
+	if (!(oh->flags & HWMOD_NO_IDLE_LOCKING))
+		mutex_lock(&omap_hwmod_mutex);
+
 	r = _enable(oh);
-	mutex_unlock(&omap_hwmod_mutex);
+
+	if (!(oh->flags & HWMOD_NO_IDLE_LOCKING))
+		mutex_unlock(&omap_hwmod_mutex);
 
 	return r;
 }
@@ -1323,9 +1327,13 @@ int omap_hwmod_idle(struct omap_hwmod *oh)
 	if (!oh)
 		return -EINVAL;
 
-	mutex_lock(&omap_hwmod_mutex);
+	if (!(oh->flags & HWMOD_NO_IDLE_LOCKING))
+		mutex_lock(&omap_hwmod_mutex);
+
 	_idle(oh);
-	mutex_unlock(&omap_hwmod_mutex);
+
+	if (!(oh->flags & HWMOD_NO_IDLE_LOCKING))
+		mutex_unlock(&omap_hwmod_mutex);
 
 	return 0;
 }
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 0eccc09..cc3f9a7 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -360,6 +360,7 @@ struct omap_hwmod_omap4_prcm {
 #define HWMOD_NO_OCP_AUTOIDLE			(1 << 4)
 #define HWMOD_SET_DEFAULT_CLOCKACT		(1 << 5)
 #define HWMOD_NO_IDLEST				(1 << 6)
+#define HWMOD_NO_IDLE_LOCKING       (1 << 7)
 
 /*
  * omap_hwmod._int_flags definitions
-- 
1.7.0.2


  parent reply	other threads:[~2010-05-27 21:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 21:13 [PATCH 0/5] OMAP2/3: misc. hwmod fixes Kevin Hilman
2010-05-27 21:13 ` [PATCH 1/5] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE Kevin Hilman
2010-05-27 21:13 ` [PATCH 2/5] OMAP: hwmod: if IDLEST fields are not set, use module defaults Kevin Hilman
2010-06-18 16:43   ` Kevin Hilman
2010-05-27 21:13 ` Kevin Hilman [this message]
2010-05-27 21:13 ` [PATCH 4/5] OMAP24xx: CM: fix mask used for checking IDLEST status Kevin Hilman
2010-05-27 21:13 ` [PATCH 5/5] OMAP2/3: hwmod: L3 and L4 CORE/PER/WKUP hwmods don't have IDLEST Kevin Hilman

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=1274994816-30335-4-git-send-email-khilman@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.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).