Skip to content

Commit

Permalink
Add mutex around bcm_mailbox_property function
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Jan 7, 2013
1 parent b7c5c10 commit ef0b3d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion arch/arm/mach-bcm2708/vcio.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,15 @@ static int mbox_copy_to_user(void *dst, const void *src, int size)
}
}


static DEFINE_MUTEX(mailbox_lock);
extern int bcm_mailbox_property(void *data, int size)
{
uint32_t success;
dma_addr_t mem_bus; /* the memory address accessed from videocore */
void *mem_kern; /* the memory address accessed from driver */
int s = 0;

mutex_lock(&mailbox_lock);
/* allocate some memory for the messages communicating with GPU */
mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, GFP_ATOMIC);
if (mem_kern) {
Expand All @@ -276,6 +277,8 @@ extern int bcm_mailbox_property(void *data, int size)
}
if (s != 0)
printk(KERN_ERR DRIVER_NAME ": %s failed (%d)\n", __func__, s);

mutex_unlock(&mailbox_lock);
return s;
}
EXPORT_SYMBOL_GPL(bcm_mailbox_property);
Expand Down

0 comments on commit ef0b3d3

Please sign in to comment.