From: Fernando Guzman Lugo <x0095840@ti.com> To: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Cc: hiroshi.doyu@nokia.com, ohad@wizery.com, Fernando Guzman Lugo <x0095840@ti.com> Subject: [PATCHv2] mailbox: change full flag per mailbox queue instead of global Date: Tue, 10 Aug 2010 20:12:49 -0500 [thread overview] Message-ID: <1281489169-15945-1-git-send-email-x0095840@ti.com> (raw) As pointed by Ohad Ben-Cohen, the variable rq_full flag is a global variable, so if there are multiple mailbox users there will be conflics. Now there is a full flag per mailbox queue. Version 2: - Rebase to the latest. Reported-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com> --- arch/arm/plat-omap/include/plat/mailbox.h | 1 + arch/arm/plat-omap/mailbox.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h index 9976565..261f6b8 100644 --- a/arch/arm/plat-omap/include/plat/mailbox.h +++ b/arch/arm/plat-omap/include/plat/mailbox.h @@ -48,6 +48,7 @@ struct omap_mbox_queue { struct tasklet_struct tasklet; int (*callback)(void *); struct omap_mbox *mbox; + bool full; }; struct omap_mbox { diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index d2fafb8..c59c9c3 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c @@ -33,7 +33,6 @@ static struct workqueue_struct *mboxd; static struct omap_mbox **mboxes; -static bool rq_full; static int mbox_configured; static DEFINE_MUTEX(mbox_configured_lock); @@ -145,7 +144,12 @@ static void mbox_rx_work(struct work_struct *work) while (kfifo_len(&mq->fifo) >= sizeof(msg)) { len = kfifo_out(&mq->fifo, (unsigned char *)&msg, sizeof(msg)); WARN_ON(len != sizeof(msg)); - + spin_lock_irq(&mq->lock); + if (mq->full) { + omap_mbox_enable_irq(mq->mbox, IRQ_RX); + mq->full = false; + } + spin_unlock_irq(&mq->lock); if (mq->callback) mq->callback((void *)msg); } @@ -170,7 +174,7 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox) while (!mbox_fifo_empty(mbox)) { if (unlikely(kfifo_avail(&mq->fifo) < sizeof(msg))) { omap_mbox_disable_irq(mbox, IRQ_RX); - rq_full = true; + mq->full = true; goto nomem; } -- 1.6.3.3
WARNING: multiple messages have this Message-ID (diff)
From: x0095840@ti.com (Fernando Guzman Lugo) To: linux-arm-kernel@lists.infradead.org Subject: [PATCHv2] mailbox: change full flag per mailbox queue instead of global Date: Tue, 10 Aug 2010 20:12:49 -0500 [thread overview] Message-ID: <1281489169-15945-1-git-send-email-x0095840@ti.com> (raw) As pointed by Ohad Ben-Cohen, the variable rq_full flag is a global variable, so if there are multiple mailbox users there will be conflics. Now there is a full flag per mailbox queue. Version 2: - Rebase to the latest. Reported-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com> --- arch/arm/plat-omap/include/plat/mailbox.h | 1 + arch/arm/plat-omap/mailbox.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h index 9976565..261f6b8 100644 --- a/arch/arm/plat-omap/include/plat/mailbox.h +++ b/arch/arm/plat-omap/include/plat/mailbox.h @@ -48,6 +48,7 @@ struct omap_mbox_queue { struct tasklet_struct tasklet; int (*callback)(void *); struct omap_mbox *mbox; + bool full; }; struct omap_mbox { diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index d2fafb8..c59c9c3 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c @@ -33,7 +33,6 @@ static struct workqueue_struct *mboxd; static struct omap_mbox **mboxes; -static bool rq_full; static int mbox_configured; static DEFINE_MUTEX(mbox_configured_lock); @@ -145,7 +144,12 @@ static void mbox_rx_work(struct work_struct *work) while (kfifo_len(&mq->fifo) >= sizeof(msg)) { len = kfifo_out(&mq->fifo, (unsigned char *)&msg, sizeof(msg)); WARN_ON(len != sizeof(msg)); - + spin_lock_irq(&mq->lock); + if (mq->full) { + omap_mbox_enable_irq(mq->mbox, IRQ_RX); + mq->full = false; + } + spin_unlock_irq(&mq->lock); if (mq->callback) mq->callback((void *)msg); } @@ -170,7 +174,7 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox) while (!mbox_fifo_empty(mbox)) { if (unlikely(kfifo_avail(&mq->fifo) < sizeof(msg))) { omap_mbox_disable_irq(mbox, IRQ_RX); - rq_full = true; + mq->full = true; goto nomem; } -- 1.6.3.3
next reply other threads:[~2010-08-11 0:59 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-08-11 1:12 Fernando Guzman Lugo [this message] 2010-08-11 1:12 ` [PATCHv2] mailbox: change full flag per mailbox queue instead of global Fernando Guzman Lugo 2010-08-11 5:43 ` Hiroshi DOYU 2010-08-11 5:43 ` Hiroshi DOYU 2010-08-19 16:09 ` Sapiens, Rene 2010-08-19 16:09 ` Sapiens, Rene
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1281489169-15945-1-git-send-email-x0095840@ti.com \ --to=x0095840@ti.com \ --cc=hiroshi.doyu@nokia.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=ohad@wizery.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.