aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/mailbox.c
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2010-05-05 11:33:06 -0400
committerHiroshi DOYU <Hiroshi.DOYU@nokia.com>2010-08-04 08:50:16 -0400
commit10d1a0028dc4549bd8e887641cc283f5f184f819 (patch)
treef1f999dbc1bc46c92307d262bc9eb18accf85470 /arch/arm/plat-omap/mailbox.c
parent1ea5d6d18bf1d528ae1081b9176d69c00bd51fa2 (diff)
omap: mailbox: convert rwlocks to spinlock
rwlocks are slower and have potential starvation issues therefore spinlocks are generally preferred. see also: http://lwn.net/Articles/364583/ Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Kanigeri Hari <h-kanigeri2@ti.com> Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Diffstat (limited to 'arch/arm/plat-omap/mailbox.c')
-rw-r--r--arch/arm/plat-omap/mailbox.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index c3402165488d..fafe47bf2f55 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -31,7 +31,7 @@
31 31
32static struct workqueue_struct *mboxd; 32static struct workqueue_struct *mboxd;
33static struct omap_mbox *mboxes; 33static struct omap_mbox *mboxes;
34static DEFINE_RWLOCK(mboxes_lock); 34static DEFINE_SPINLOCK(mboxes_lock);
35static bool rq_full; 35static bool rq_full;
36 36
37static int mbox_configured; 37static int mbox_configured;
@@ -341,14 +341,14 @@ struct omap_mbox *omap_mbox_get(const char *name)
341 struct omap_mbox *mbox; 341 struct omap_mbox *mbox;
342 int ret; 342 int ret;
343 343
344 read_lock(&mboxes_lock); 344 spin_lock(&mboxes_lock);
345 mbox = *(find_mboxes(name)); 345 mbox = *(find_mboxes(name));
346 if (mbox == NULL) { 346 if (mbox == NULL) {
347 read_unlock(&mboxes_lock); 347 spin_unlock(&mboxes_lock);
348 return ERR_PTR(-ENOENT); 348 return ERR_PTR(-ENOENT);
349 } 349 }
350 350
351 read_unlock(&mboxes_lock); 351 spin_unlock(&mboxes_lock);
352 352
353 ret = omap_mbox_startup(mbox); 353 ret = omap_mbox_startup(mbox);
354 if (ret) 354 if (ret)
@@ -374,15 +374,15 @@ int omap_mbox_register(struct device *parent, struct omap_mbox *mbox)
374 if (mbox->next) 374 if (mbox->next)
375 return -EBUSY; 375 return -EBUSY;
376 376
377 write_lock(&mboxes_lock); 377 spin_lock(&mboxes_lock);
378 tmp = find_mboxes(mbox->name); 378 tmp = find_mboxes(mbox->name);
379 if (*tmp) { 379 if (*tmp) {
380 ret = -EBUSY; 380 ret = -EBUSY;
381 write_unlock(&mboxes_lock); 381 spin_unlock(&mboxes_lock);
382 goto err_find; 382 goto err_find;
383 } 383 }
384 *tmp = mbox; 384 *tmp = mbox;
385 write_unlock(&mboxes_lock); 385 spin_unlock(&mboxes_lock);
386 386
387 return 0; 387 return 0;
388 388
@@ -395,18 +395,18 @@ int omap_mbox_unregister(struct omap_mbox *mbox)
395{ 395{
396 struct omap_mbox **tmp; 396 struct omap_mbox **tmp;
397 397
398 write_lock(&mboxes_lock); 398 spin_lock(&mboxes_lock);
399 tmp = &mboxes; 399 tmp = &mboxes;
400 while (*tmp) { 400 while (*tmp) {
401 if (mbox == *tmp) { 401 if (mbox == *tmp) {
402 *tmp = mbox->next; 402 *tmp = mbox->next;
403 mbox->next = NULL; 403 mbox->next = NULL;
404 write_unlock(&mboxes_lock); 404 spin_unlock(&mboxes_lock);
405 return 0; 405 return 0;
406 } 406 }
407 tmp = &(*tmp)->next; 407 tmp = &(*tmp)->next;
408 } 408 }
409 write_unlock(&mboxes_lock); 409 spin_unlock(&mboxes_lock);
410 410
411 return -EINVAL; 411 return -EINVAL;
412} 412}