Re: [PATCH 2/3] mailbox: mtk-cmdq: Use mailbox rx_callback

From: Yongqiang Niu
Date: Wed May 26 2021 - 02:51:53 EST


Reviewed-by: Yongqiang Niu <yongqiang.niu@xxxxxxxxxxxx>

On Wed, 2021-05-26 at 14:17 +0800, Chun-Kuang Hu wrote:
> + Yongqiang
>
> Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx> 於 2021年3月15日 週一 上午7:33寫道:
> >
> > rx_callback is a standard mailbox callback mechanism and could cover the
> > function of proprietary cmdq_task_cb, so use the standard one instead of
> > the proprietary one. But the client driver has already used cmdq_task_cb,
> > so keep cmdq_task_cb until all client driver use rx_callback instead of
> > cmdq_task_cb.
> >
> > Cc: Jassi Brar <jassisinghbrar@xxxxxxxxx>
> > Cc: Matthias Brugger <matthias.bgg@xxxxxxxxx>
> > Cc: Houlong Wei <houlong.wei@xxxxxxxxxxxx>
> > Cc: Bibby Hsieh <bibby.hsieh@xxxxxxxxxxxx>
> > Cc: Dennis YC Hsieh <dennis-yc.hsieh@xxxxxxxxxxxx>
> > Cc: linux-kernel@xxxxxxxxxxxxxxx
> > Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> > Cc: linux-mediatek@xxxxxxxxxxxxxxxxxxx
> > Signed-off-by: Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx>
> > ---
> > drivers/mailbox/mtk-cmdq-mailbox.c | 14 +++++++++-----
> > 1 file changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
> > index 3d37c1cd40f1..ef59e2234f22 100644
> > --- a/drivers/mailbox/mtk-cmdq-mailbox.c
> > +++ b/drivers/mailbox/mtk-cmdq-mailbox.c
> > @@ -188,7 +188,10 @@ static void cmdq_task_exec_done(struct cmdq_task *task, int sta)
> > WARN_ON(cb->cb == (cmdq_async_flush_cb)NULL);
> > data.sta = sta;
> > data.data = cb->data;
> > - cb->cb(data);
> > + if (cb->cb)
> > + cb->cb(data);
> > +
> > + mbox_chan_received_data(task->thread->chan, &data);
> >
> > list_del(&task->list_entry);
> > }
> > @@ -451,12 +454,13 @@ static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout)
> >
> > list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
> > list_entry) {
> > + data.sta = -ECONNABORTED;
> > + data.data = cb->data;
> > cb = &task->pkt->async_cb;
> > - if (cb->cb) {
> > - data.sta = -ECONNABORTED;
> > - data.data = cb->data;
> > + if (cb->cb)
> > cb->cb(data);
> > - }
> > +
> > + mbox_chan_received_data(task->thread->chan, &data);
> > list_del(&task->list_entry);
> > kfree(task);
> > }
> > --
> > 2.17.1
> >