Skip to content

Commit f11ff34

Browse files
eberman-quicJassiBrar
authored andcommitted
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 <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 85a9538 commit f11ff34

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

drivers/mailbox/omap-mailbox.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ struct mbox_chan *omap_mbox_request_channel(struct mbox_client *cl,
417417
struct device *dev = cl->dev;
418418
struct omap_mbox *mbox = NULL;
419419
struct omap_mbox_device *mdev;
420-
struct mbox_chan *chan;
421-
unsigned long flags;
422420
int ret;
423421

424422
if (!dev)
@@ -441,23 +439,11 @@ struct mbox_chan *omap_mbox_request_channel(struct mbox_client *cl,
441439
if (!mbox || !mbox->chan)
442440
return ERR_PTR(-ENOENT);
443441

444-
chan = mbox->chan;
445-
spin_lock_irqsave(&chan->lock, flags);
446-
chan->msg_free = 0;
447-
chan->msg_count = 0;
448-
chan->active_req = NULL;
449-
chan->cl = cl;
450-
init_completion(&chan->tx_complete);
451-
spin_unlock_irqrestore(&chan->lock, flags);
452-
453-
ret = chan->mbox->ops->startup(chan);
454-
if (ret) {
455-
pr_err("Unable to startup the chan (%d)\n", ret);
456-
mbox_free_channel(chan);
457-
chan = ERR_PTR(ret);
458-
}
442+
ret = mbox_bind_client(mbox->chan, cl);
443+
if (ret)
444+
return ERR_PTR(ret);
459445

460-
return chan;
446+
return mbox->chan;
461447
}
462448
EXPORT_SYMBOL(omap_mbox_request_channel);
463449

0 commit comments

Comments
 (0)