aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorHiroshi DOYU <Hiroshi.DOYU@nokia.com>2010-02-18 01:48:55 -0500
committerHiroshi DOYU <Hiroshi.DOYU@nokia.com>2010-08-04 08:50:16 -0400
commit72b917ef90084885ffcc5adb69095af02d2b6996 (patch)
tree69faf94c1eb1a00e5e4e713e40993100e8dacd80 /arch/arm
parent9caae4d87ca0087edd6c02efd674f13fe0419ee9 (diff)
Mailbox: new mutext lock for h/w mailbox configuration
mailbox startup and shutdown are being executed against a single H/W module, and a mailbox H/W module is totally __independent__ of the registration of logical mailboxes. So, an independent mutext should be used for startup and shutdown. Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com> Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/plat-omap/mailbox.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 72efbe5be578..986002b089fd 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -34,6 +34,7 @@ static struct omap_mbox *mboxes;
34static DEFINE_RWLOCK(mboxes_lock); 34static DEFINE_RWLOCK(mboxes_lock);
35 35
36static int mbox_configured; 36static int mbox_configured;
37static DEFINE_MUTEX(mbox_configured_lock);
37 38
38/* Mailbox FIFO handle functions */ 39/* Mailbox FIFO handle functions */
39static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox) 40static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox)
@@ -250,16 +251,16 @@ static int omap_mbox_startup(struct omap_mbox *mbox)
250 struct omap_mbox_queue *mq; 251 struct omap_mbox_queue *mq;
251 252
252 if (likely(mbox->ops->startup)) { 253 if (likely(mbox->ops->startup)) {
253 write_lock(&mboxes_lock); 254 mutex_lock(&mbox_configured_lock);
254 if (!mbox_configured) 255 if (!mbox_configured)
255 ret = mbox->ops->startup(mbox); 256 ret = mbox->ops->startup(mbox);
256 257
257 if (unlikely(ret)) { 258 if (unlikely(ret)) {
258 write_unlock(&mboxes_lock); 259 mutex_unlock(&mbox_configured_lock);
259 return ret; 260 return ret;
260 } 261 }
261 mbox_configured++; 262 mbox_configured++;
262 write_unlock(&mboxes_lock); 263 mutex_unlock(&mbox_configured_lock);
263 } 264 }
264 265
265 ret = request_irq(mbox->irq, mbox_interrupt, IRQF_SHARED, 266 ret = request_irq(mbox->irq, mbox_interrupt, IRQF_SHARED,
@@ -306,12 +307,12 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
306 mbox_queue_free(mbox->rxq); 307 mbox_queue_free(mbox->rxq);
307 308
308 if (unlikely(mbox->ops->shutdown)) { 309 if (unlikely(mbox->ops->shutdown)) {
309 write_lock(&mboxes_lock); 310 mutex_lock(&mbox_configured_lock);
310 if (mbox_configured > 0) 311 if (mbox_configured > 0)
311 mbox_configured--; 312 mbox_configured--;
312 if (!mbox_configured) 313 if (!mbox_configured)
313 mbox->ops->shutdown(mbox); 314 mbox->ops->shutdown(mbox);
314 write_unlock(&mboxes_lock); 315 mutex_unlock(&mbox_configured_lock);
315 } 316 }
316} 317}
317 318