From: Elliot Berman <quic_eberman@quicinc.com>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Elliot Berman <quic_eberman@quicinc.com>,
Sudeep Holla <sudeep.holla@arm.com>,
<linux-kernel@vger.kernel.org>, <linux-acpi@vger.kernel.org>,
<linux-arm-msm@vger.kernel.org>
Subject: [PATCH 2/3] mailbox: omap: Use mbox_bind_client
Date: Mon, 13 Feb 2023 15:25:36 -0800 [thread overview]
Message-ID: <20230213232537.2040976-3-quic_eberman@quicinc.com> (raw)
In-Reply-To: <20230213232537.2040976-1-quic_eberman@quicinc.com>
Use generic mbox_bind_client() to bind omap mailbox channel to a client.
mbox_bind_client is identical to the replaced lines, except that it:
- Does the operation under con_mutex which prevents possible races in
removal path
- Sets TXDONE_BY_ACK if omap uses TXDONE_BY_POLL. omap uses
TXDONE_BY_IRQ, so this check is not applicable.
- Calls chan->mbox->ops->startup, if available. omap doesn't have, so
this is not applicable.
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
---
drivers/mailbox/omap-mailbox.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c
index 098c82d87137..dfe82a5ff403 100644
--- a/drivers/mailbox/omap-mailbox.c
+++ b/drivers/mailbox/omap-mailbox.c
@@ -417,8 +417,6 @@ struct mbox_chan *omap_mbox_request_channel(struct mbox_client *cl,
struct device *dev = cl->dev;
struct omap_mbox *mbox = NULL;
struct omap_mbox_device *mdev;
- struct mbox_chan *chan;
- unsigned long flags;
int ret;
if (!dev)
@@ -441,23 +439,11 @@ struct mbox_chan *omap_mbox_request_channel(struct mbox_client *cl,
if (!mbox || !mbox->chan)
return ERR_PTR(-ENOENT);
- chan = mbox->chan;
- spin_lock_irqsave(&chan->lock, flags);
- chan->msg_free = 0;
- chan->msg_count = 0;
- chan->active_req = NULL;
- chan->cl = cl;
- init_completion(&chan->tx_complete);
- spin_unlock_irqrestore(&chan->lock, flags);
-
- ret = chan->mbox->ops->startup(chan);
- if (ret) {
- pr_err("Unable to startup the chan (%d)\n", ret);
- mbox_free_channel(chan);
- chan = ERR_PTR(ret);
- }
+ ret = mbox_bind_client(mbox->chan, cl);
+ if (ret)
+ return ERR_PTR(ret);
- return chan;
+ return mbox->chan;
}
EXPORT_SYMBOL(omap_mbox_request_channel);
--
2.39.1
next prev parent reply other threads:[~2023-02-13 23:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 23:25 [PATCH 0/3] mailbox: Allow direct registration to a channel Elliot Berman
2023-02-13 23:25 ` Elliot Berman [this message]
2023-02-13 23:25 ` [PATCH 3/3] mailbox: pcc: Use mbox_bind_client Elliot Berman
2023-02-15 10:17 ` [PATCH 0/3] mailbox: Allow direct registration to a channel Sudeep Holla
2023-02-15 16:58 ` Elliot Berman
2023-02-16 9:58 ` Sudeep Holla
2023-02-16 16:41 ` Elliot Berman
2023-02-22 13:59 ` Sudeep Holla
2023-02-16 16:38 ` [PATCH 1/3] " Elliot Berman
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=20230213232537.2040976-3-quic_eberman@quicinc.com \
--to=quic_eberman@quicinc.com \
--cc=jassisinghbrar@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudeep.holla@arm.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: 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
all inboxes | Powered by JetHome®