Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions drivers/mailbox/mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static void msg_submit(struct mbox_chan *chan)
int err = -EBUSY;

scoped_guard(spinlock_irqsave, &chan->lock) {
if (!chan->msg_count || chan->active_req != MBOX_NO_MSG)
if (!chan->msg_count || chan->active_req)
break;

count = chan->msg_count;
Expand Down Expand Up @@ -87,13 +87,13 @@ static void tx_tick(struct mbox_chan *chan, int r)

scoped_guard(spinlock_irqsave, &chan->lock) {
mssg = chan->active_req;
chan->active_req = MBOX_NO_MSG;
chan->active_req = NULL;
}

/* Submit next message */
msg_submit(chan);

if (mssg == MBOX_NO_MSG)
if (!mssg)
return;

/* Notify the client */
Expand All @@ -114,7 +114,7 @@ static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
for (i = 0; i < mbox->num_chans; i++) {
struct mbox_chan *chan = &mbox->chans[i];

if (chan->active_req != MBOX_NO_MSG && chan->cl) {
if (chan->active_req && chan->cl) {
txdone = chan->mbox->ops->last_tx_done(chan);
if (txdone)
tx_tick(chan, 0);
Expand Down Expand Up @@ -246,7 +246,7 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)
{
int t;

if (!chan || !chan->cl || mssg == MBOX_NO_MSG)
if (!chan || !chan->cl)
return -EINVAL;

t = add_to_rbuf(chan, mssg);
Expand Down Expand Up @@ -319,7 +319,7 @@ static int __mbox_bind_client(struct mbox_chan *chan, struct mbox_client *cl)
scoped_guard(spinlock_irqsave, &chan->lock) {
chan->msg_free = 0;
chan->msg_count = 0;
chan->active_req = MBOX_NO_MSG;
chan->active_req = NULL;
chan->cl = cl;
init_completion(&chan->tx_complete);

Expand Down Expand Up @@ -477,7 +477,7 @@ void mbox_free_channel(struct mbox_chan *chan)
/* The queued TX requests are simply aborted, no callbacks are made */
scoped_guard(spinlock_irqsave, &chan->lock) {
chan->cl = NULL;
chan->active_req = MBOX_NO_MSG;
chan->active_req = NULL;
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;
}
Expand Down Expand Up @@ -531,7 +531,6 @@ int mbox_controller_register(struct mbox_controller *mbox)

chan->cl = NULL;
chan->mbox = mbox;
chan->active_req = MBOX_NO_MSG;
chan->txdone_method = txdone;
spin_lock_init(&chan->lock);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/mailbox/tegra-hsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ static int tegra_hsp_mailbox_flush(struct mbox_chan *chan,
mbox_chan_txdone(chan, 0);

/* Wait until channel is empty */
if (chan->active_req != MBOX_NO_MSG)
if (chan->active_req != NULL)
continue;

return 0;
Expand Down
3 changes: 0 additions & 3 deletions include/linux/mailbox_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

struct mbox_chan;

/* Sentinel value distinguishing "no active request" from "NULL message data" */
#define MBOX_NO_MSG ((void *)-1)

/**
* struct mbox_chan_ops - methods to control mailbox channels
* @send_data: The API asks the MBOX controller driver, in atomic
Expand Down
Loading