diff options
author | Elliot Berman <quic_eberman@quicinc.com> | 2023-04-10 09:16:53 -0700 |
---|---|---|
committer | Jassi Brar <jaswinder.singh@linaro.org> | 2023-04-18 11:48:55 -0500 |
commit | f11ff34d883a26f4f13c307aeb556f2b076a5066 (patch) | |
tree | 8c8f0eb05df0abd0e2807cb66641ed2f0e4fb1e7 /drivers/mailbox | |
parent | 85a953806557dbf25d16e8c132b5b9b100d16496 (diff) | |
download | linux-f11ff34d883a26f4f13c307aeb556f2b076a5066.tar.gz linux-f11ff34d883a26f4f13c307aeb556f2b076a5066.tar.bz2 linux-f11ff34d883a26f4f13c307aeb556f2b076a5066.zip |
mailbox: omap: Use mbox_bind_client
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>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r-- | drivers/mailbox/omap-mailbox.c | 22 |
1 files 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); |