Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Suman Anna <s-anna@ti.com>
To: Greg Kroah-Hartman <greg@linuxfoundation.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>, Paul Walmsley <paul@pwsan.com>,
	linux-omap@vger.kernel.org, Russell King <linux@arm.linux.org.uk>,
	Benoit Cousson <b-cousson@ti.com>, Arnd Bergmann <arnd@arndb.de>,
	Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>,
	Tony Lindgren <tony@atomide.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	linux-kernel@vger.kernel.org,
	Felipe Contreras <felipe.contreras@nokia.com>,
	Dom Cobley <popcornmix@gmail.com>,
	Wim Van Sebroeck <wim@iguana.be>,
	Omar Ramirez Luna <omar.ramirez@copitl.com>,
	Tejun Heo <tj@kernel.org>,
	Omar Ramirez Luna <omar.luna@linaro.org>,
	Loic Pallardy <loic.pallardy@st.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 06/13] mailbox: change protection mechanisms
Date: Mon, 11 Feb 2013 22:57:05 -0600	[thread overview]
Message-ID: <1360645032-9668-7-git-send-email-s-anna@ti.com> (raw)
In-Reply-To: <1360645032-9668-1-git-send-email-s-anna@ti.com>

From: Loic Pallardy <loic.pallardy@st.com>

TX: replace spin by mutex to release CPU
during wait on mailbox resource.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mailbox/mailbox.c          | 5 +++--
 drivers/mailbox/mailbox_internal.h | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 6b43e7c..ff6595a 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -94,7 +94,7 @@ int mailbox_msg_send(struct mailbox *mbox, struct mailbox_msg *msg)
 	struct mailbox_queue *mq = mbox->txq;
 	int ret = 0, len;
 
-	spin_lock_bh(&mq->lock);
+	mutex_lock(&mq->mlock);
 
 	if (kfifo_avail(&mq->fifo) < (sizeof(msg) + msg->size)) {
 		ret = -ENOMEM;
@@ -118,7 +118,7 @@ int mailbox_msg_send(struct mailbox *mbox, struct mailbox_msg *msg)
 	tasklet_schedule(&mbox->txq->tasklet);
 
 out:
-	spin_unlock_bh(&mq->lock);
+	mutex_unlock(&mq->mlock);
 	return ret;
 }
 EXPORT_SYMBOL(mailbox_msg_send);
@@ -289,6 +289,7 @@ static struct mailbox_queue *mbox_queue_alloc(struct mailbox *mbox,
 		return NULL;
 
 	spin_lock_init(&mq->lock);
+	mutex_init(&mq->mlock);
 
 	if (kfifo_alloc(&mq->fifo, mbox_kfifo_size, GFP_KERNEL))
 		goto error;
diff --git a/drivers/mailbox/mailbox_internal.h b/drivers/mailbox/mailbox_internal.h
index ba03910..04f83bf 100644
--- a/drivers/mailbox/mailbox_internal.h
+++ b/drivers/mailbox/mailbox_internal.h
@@ -45,6 +45,7 @@ struct mailbox_ops {
 
 struct mailbox_queue {
 	spinlock_t              lock;
+	struct mutex		mlock;
 	struct kfifo            fifo;
 	struct work_struct      work;
 	struct tasklet_struct   tasklet;
-- 
1.8.1.2

  parent reply	other threads:[~2013-02-12  4:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12  4:56 [PATCH v2 00/13] drivers: mailbox: framework creation Suman Anna
2013-02-12  4:57 ` [PATCH v2 01/13] ARM: OMAP2+: mbox: remove dependencies with soc.h Suman Anna
2013-02-12  4:57 ` [PATCH v2 02/13] mailbox: OMAP: introduce mailbox framework Suman Anna
2013-02-12  4:57 ` [PATCH v2 03/13] mailbox: split internal header from API header Suman Anna
2013-02-12  4:57 ` [PATCH v2 04/13] mailbox: rename omap_mbox in mailbox Suman Anna
2013-02-12  4:57 ` [PATCH v2 05/13] mailbox: create opened message type Suman Anna
2013-02-12  4:57 ` Suman Anna [this message]
2013-02-12  4:57 ` [PATCH v2 07/13] mailbox: add shared memory mailbox type Suman Anna
2013-02-12  4:57 ` [PATCH v2 08/13] mailbox: add IRQF_NO_SUSPEND flag Suman Anna
2013-02-12  4:57 ` [PATCH v2 09/13] mailbox: add no_irq send message Suman Anna
2013-02-12  4:57 ` [PATCH v2 10/13] mailbox: create dbx500 mailbox driver Suman Anna
2013-02-12 10:39   ` Mark Rutland
2013-02-12 20:01     ` Loic PALLARDY
2013-02-13  9:08       ` Mark Rutland
2013-02-12  4:57 ` [PATCH v2 11/13] mailbox/omap: check iomem resource before dereferencing it Suman Anna
2013-02-12  4:57 ` [PATCH v2 12/13] mailbox: check for NULL nb in mailbox_put Suman Anna
2013-02-12  4:57 ` [PATCH v2 13/13] mailbox: call request_irq after mbox queues are allocated Suman Anna
2013-02-13 13:36 ` [PATCH v2 00/13] drivers: mailbox: framework creation Linus Walleij
2013-02-13 13:42   ` Russell King - ARM Linux
2013-02-13 16:41     ` Anna, Suman
2013-02-13 20:36       ` Loic PALLARDY

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=1360645032-9668-7-git-send-email-s-anna@ti.com \
    --to=s-anna@ti.com \
    --cc=arnd@arndb.de \
    --cc=b-cousson@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=felipe.contreras@nokia.com \
    --cc=greg@linuxfoundation.org \
    --cc=jkrzyszt@tis.icnet.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=loic.pallardy@st.com \
    --cc=ohad@wizery.com \
    --cc=omar.luna@linaro.org \
    --cc=omar.ramirez@copitl.com \
    --cc=paul@pwsan.com \
    --cc=popcornmix@gmail.com \
    --cc=tj@kernel.org \
    --cc=tony@atomide.com \
    --cc=wim@iguana.be \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox