[PATCH 6/7] omap:mailbox-add notification support for multiple readers

Omar Ramirez Luna omar.ramirez at ti.com
Thu Oct 28 16:57:41 EDT 2010


Hi,

On 10/14/2010 9:13 PM, Hari Kanigeri wrote:
> @@ -252,41 +253,39 @@ static int omap_mbox_startup(struct omap_mbox *mbox)
...
> +	if (!mbox->use_count++) {
> +		ret = request_irq(mbox->irq, mbox_interrupt, IRQF_SHARED,
> +					mbox->name, mbox);
...
> @@ -296,29 +295,36 @@ fail_alloc_txq:
...
>   static void omap_mbox_fini(struct omap_mbox *mbox)
>   {
> +	if (!--mbox->use_count) {
> +		tasklet_kill(&mbox->txq->tasklet);
> +		flush_work(&mbox->rxq->work);
> +		mbox_queue_free(mbox->txq);
> +		mbox_queue_free(mbox->rxq);
> +	}
> +
> +	if (likely(mbox->ops->shutdown)) {
> +		if (!--mbox_configured) {
> +			free_irq(mbox->irq, mbox);

Above hunks will create an imbalance of free_irq, as request_irq can be 
called per registered mailbox and free_irq is only done for the last 
caller releasing the mailbox handle.

e.g.: mbox-1, mbox-N will request a shared irq on the same interrupt 
line, but only the last caller of omap_mbox_put will free its irq, 
leaving the other one there.

This can be fixed if the free is moved to be executed within the 
following block:

	if (!--mbox->use_count) {
		...
		free_irq(mbox->irq, mbox);
	}

Regards,

Omar



More information about the linux-arm-kernel mailing list