From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Tony Lindgren <tony@atomide.com>, <paul@pwsan.com>
Cc: <linux-omap@vger.kernel.org>, <peterz@infradead.org>,
<mingo@redhat.com>, <linux-kernel@vger.kernel.org>,
<balbi@ti.com>, <linux-arm-kernel@lists.infradead.org>
Subject: [PATCH 1/2] ARM: omap2+: omap_hwmod: Use _nested version of spinlock for oh->_lock
Date: Fri, 6 Feb 2015 14:48:35 +0200 [thread overview]
Message-ID: <1423226916-18804-2-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1423226916-18804-1-git-send-email-peter.ujfalusi@ti.com>
Add lockdep_class member to struct omap_hwmod and use this number to
specify the subclass of the given hwmod's lock.
When defining the hwmods the lockdep_level can be initialized to indicate
that this lock might be used in a nested fashion.
DRA7x's ATL hwmod is one example for this since McASP can select ATL clock
as functional clock, which will trigger nested oh->_lock usage. This will
trigger false warning from lockdep validator since it is dealing with
classes and for it all hwmod clocks are the same class.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 16 ++++++++--------
arch/arm/mach-omap2/omap_hwmod.h | 5 +++++
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 92afb723dcfc..b5afde560054 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -3334,7 +3334,7 @@ int omap_hwmod_enable(struct omap_hwmod *oh)
if (!oh)
return -EINVAL;
- spin_lock_irqsave(&oh->_lock, flags);
+ spin_lock_irqsave_nested(&oh->_lock, flags, oh->lockdep_class);
r = _enable(oh);
spin_unlock_irqrestore(&oh->_lock, flags);
@@ -3355,7 +3355,7 @@ int omap_hwmod_idle(struct omap_hwmod *oh)
if (!oh)
return -EINVAL;
- spin_lock_irqsave(&oh->_lock, flags);
+ spin_lock_irqsave_nested(&oh->_lock, flags, oh->lockdep_class);
_idle(oh);
spin_unlock_irqrestore(&oh->_lock, flags);
@@ -3377,7 +3377,7 @@ int omap_hwmod_shutdown(struct omap_hwmod *oh)
if (!oh)
return -EINVAL;
- spin_lock_irqsave(&oh->_lock, flags);
+ spin_lock_irqsave_nested(&oh->_lock, flags, oh->lockdep_class);
_shutdown(oh);
spin_unlock_irqrestore(&oh->_lock, flags);
@@ -3667,7 +3667,7 @@ int omap_hwmod_enable_wakeup(struct omap_hwmod *oh)
unsigned long flags;
u32 v;
- spin_lock_irqsave(&oh->_lock, flags);
+ spin_lock_irqsave_nested(&oh->_lock, flags, oh->lockdep_class);
if (oh->class->sysc &&
(oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)) {
@@ -3700,7 +3700,7 @@ int omap_hwmod_disable_wakeup(struct omap_hwmod *oh)
unsigned long flags;
u32 v;
- spin_lock_irqsave(&oh->_lock, flags);
+ spin_lock_irqsave_nested(&oh->_lock, flags, oh->lockdep_class);
if (oh->class->sysc &&
(oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)) {
@@ -3735,7 +3735,7 @@ int omap_hwmod_assert_hardreset(struct omap_hwmod *oh, const char *name)
if (!oh)
return -EINVAL;
- spin_lock_irqsave(&oh->_lock, flags);
+ spin_lock_irqsave_nested(&oh->_lock, flags, oh->lockdep_class);
ret = _assert_hardreset(oh, name);
spin_unlock_irqrestore(&oh->_lock, flags);
@@ -3762,7 +3762,7 @@ int omap_hwmod_deassert_hardreset(struct omap_hwmod *oh, const char *name)
if (!oh)
return -EINVAL;
- spin_lock_irqsave(&oh->_lock, flags);
+ spin_lock_irqsave_nested(&oh->_lock, flags, oh->lockdep_class);
ret = _deassert_hardreset(oh, name);
spin_unlock_irqrestore(&oh->_lock, flags);
@@ -3836,7 +3836,7 @@ int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state)
state != _HWMOD_STATE_IDLE)
return -EINVAL;
- spin_lock_irqsave(&oh->_lock, flags);
+ spin_lock_irqsave_nested(&oh->_lock, flags, oh->lockdep_class);
if (oh->_state != _HWMOD_STATE_REGISTERED) {
ret = -EINVAL;
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 9d4bec6ee742..260d3e9c9f6d 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -606,6 +606,9 @@ struct omap_hwmod_link {
struct list_head node;
};
+#define HWMOD_LOCKDEP_SUBCLASS_NORMAL 0
+#define HWMOD_LOCKDEP_SUBCLASS_CLASS1 1 /* might be used as nested */
+
/**
* struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks)
* @name: name of the hwmod
@@ -632,6 +635,7 @@ struct omap_hwmod_link {
* @_postsetup_state: internal-use state to leave the hwmod in after _setup()
* @flags: hwmod flags (documented below)
* @_lock: spinlock serializing operations on this hwmod
+ * @lockdep_class: subclass to use with spin_lock_irqsave_nested()
* @node: list node for hwmod list (internal use)
* @parent_hwmod: (temporary) a pointer to the hierarchical parent of this hwmod
*
@@ -674,6 +678,7 @@ struct omap_hwmod {
u32 _sysc_cache;
void __iomem *_mpu_rt_va;
spinlock_t _lock;
+ unsigned int lockdep_class;
struct list_head node;
struct omap_hwmod_ocp_if *_mpu_port;
unsigned int (*xlate_irq)(unsigned int);
--
2.2.2
next prev parent reply other threads:[~2015-02-06 12:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 12:48 [PATCH 0/2] ARM: omap2+: omap_hwmod: Fix false lockdep warning Peter Ujfalusi
2015-02-06 12:48 ` Peter Ujfalusi [this message]
2015-02-06 12:48 ` [PATCH 2/2] ARM: DRA7: hwmod_data: Change locked_class for atl hwmod Peter Ujfalusi
2015-02-06 14:13 ` [PATCH 0/2] ARM: omap2+: omap_hwmod: Fix false lockdep warning Peter Zijlstra
2015-02-06 16:05 ` Peter Ujfalusi
2015-02-06 18:32 ` Peter Zijlstra
2015-02-06 19:26 ` Peter Ujfalusi
2015-02-09 8:27 ` Peter Ujfalusi
2015-02-09 9:23 ` Peter Zijlstra
2015-02-09 16:00 ` Paul Walmsley
2015-02-09 17:31 ` Tony Lindgren
2015-02-09 18:55 ` Paul Walmsley
2015-02-09 22:16 ` Tony Lindgren
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=1423226916-18804-2-git-send-email-peter.ujfalusi@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=balbi@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paul@pwsan.com \
--cc=peterz@infradead.org \
--cc=tony@atomide.com \
/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
all inboxes | Powered by JetHome®