summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuan Gutierrez <jgutierrez@ti.com>2012-05-13 15:33:04 +0300
committerOhad Ben-Cohen <ohad@wizery.com>2012-05-13 16:09:39 +0300
commit1d8a0e963ac532e038d93ab0d30bbfad072f3bf8 (patch)
tree536607fafd1014ff9f189092944e7d023b08f93b
parentd48b97b403d23f6df0b990cee652bdf9a52337a3 (diff)
downloadlinux-stable-1d8a0e963ac532e038d93ab0d30bbfad072f3bf8.tar.gz
linux-stable-1d8a0e963ac532e038d93ab0d30bbfad072f3bf8.tar.bz2
linux-stable-1d8a0e963ac532e038d93ab0d30bbfad072f3bf8.zip
ARM: OMAP: enable mailbox irq per instance
The machine-specific omap2_mbox_startup is called only once to initialize the whole mbox module, and as a result, enabling the mbox irq at that point only works for the very first mailbox instance opened. Instead, this patch makes sure enable_irq() is called every time a new mbox instance is opened. In addition, we're now enabling the mbox's irq only after its notifier_block is registered, to avoid possible race of receiving an interrupt without invoking the user's notifier callback. Signed-off-by: Juan Gutierrez <jgutierrez@ti.com> Signed-off-by: Suman Anna <s-anna@ti.com> [ohad@wizery.com: slightly reworded the commit log] Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
-rw-r--r--arch/arm/mach-omap2/mailbox.c2
-rw-r--r--arch/arm/plat-omap/mailbox.c13
2 files changed, 9 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 415a6f1cf419..f727034216a7 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -83,8 +83,6 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
l = mbox_read_reg(MAILBOX_REVISION);
pr_debug("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f));
- omap2_mbox_enable_irq(mbox, IRQ_RX);
-
return 0;
}
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index ad32621aa52e..5e13c3884aa4 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -282,6 +282,8 @@ static int omap_mbox_startup(struct omap_mbox *mbox)
}
mbox->rxq = mq;
mq->mbox = mbox;
+
+ omap_mbox_enable_irq(mbox, IRQ_RX);
}
mutex_unlock(&mbox_configured_lock);
return 0;
@@ -305,6 +307,7 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
mutex_lock(&mbox_configured_lock);
if (!--mbox->use_count) {
+ omap_mbox_disable_irq(mbox, IRQ_RX);
free_irq(mbox->irq, mbox);
tasklet_kill(&mbox->txq->tasklet);
flush_work_sync(&mbox->rxq->work);
@@ -338,13 +341,15 @@ struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb)
if (!mbox)
return ERR_PTR(-ENOENT);
- ret = omap_mbox_startup(mbox);
- if (ret)
- return ERR_PTR(-ENODEV);
-
if (nb)
blocking_notifier_chain_register(&mbox->notifier, nb);
+ ret = omap_mbox_startup(mbox);
+ if (ret) {
+ blocking_notifier_chain_unregister(&mbox->notifier, nb);
+ return ERR_PTR(-ENODEV);
+ }
+
return mbox;
}
EXPORT_SYMBOL(omap_mbox_get);