Message ID | 20210314233323.23377-4-chunkuang.hu@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Refine mtk-cmdq-mailbox callback mechanism | expand |
+ Yongqiang Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2021年3月15日 週一 上午7:33寫道: > > Current client use 'struct cmdq_pkt' as callback data, so > change 'void *data' to 'struct cmdq_pkt *pkt'. Keep data > until client use pkt instead of data. > > Cc: Jassi Brar <jassisinghbrar@gmail.com> > Cc: Matthias Brugger <matthias.bgg@gmail.com> > Cc: Houlong Wei <houlong.wei@mediatek.com> > Cc: Bibby Hsieh <bibby.hsieh@mediatek.com> > Cc: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com> > Cc: linux-kernel@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-mediatek@lists.infradead.org > Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> > --- > drivers/mailbox/mtk-cmdq-mailbox.c | 2 ++ > include/linux/mailbox/mtk-cmdq-mailbox.h | 1 + > 2 files changed, 3 insertions(+) > > diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c > index ef59e2234f22..99a9e0787501 100644 > --- a/drivers/mailbox/mtk-cmdq-mailbox.c > +++ b/drivers/mailbox/mtk-cmdq-mailbox.c > @@ -188,6 +188,7 @@ 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; > + data.pkt = task->pkt; > if (cb->cb) > cb->cb(data); > > @@ -456,6 +457,7 @@ static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout) > list_entry) { > data.sta = -ECONNABORTED; > data.data = cb->data; > + data.pkt = task->pkt; > cb = &task->pkt->async_cb; > if (cb->cb) > cb->cb(data); > diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h > index 2f7d9a37d611..44365aab043c 100644 > --- a/include/linux/mailbox/mtk-cmdq-mailbox.h > +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h > @@ -68,6 +68,7 @@ enum cmdq_code { > struct cmdq_cb_data { > int sta; > void *data; > + struct cmdq_pkt *pkt; > }; > > typedef void (*cmdq_async_flush_cb)(struct cmdq_cb_data data); > -- > 2.17.1 >
Reviewed-by: Yongqiang Niu <yongqiang.niu@mediatek.com> On Wed, 2021-05-26 at 14:18 +0800, Chun-Kuang Hu wrote: > + Yongqiang > > Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2021年3月15日 週一 上午7:33寫道: > > > > Current client use 'struct cmdq_pkt' as callback data, so > > change 'void *data' to 'struct cmdq_pkt *pkt'. Keep data > > until client use pkt instead of data. > > > > Cc: Jassi Brar <jassisinghbrar@gmail.com> > > Cc: Matthias Brugger <matthias.bgg@gmail.com> > > Cc: Houlong Wei <houlong.wei@mediatek.com> > > Cc: Bibby Hsieh <bibby.hsieh@mediatek.com> > > Cc: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com> > > Cc: linux-kernel@vger.kernel.org > > Cc: linux-arm-kernel@lists.infradead.org > > Cc: linux-mediatek@lists.infradead.org > > Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> > > --- > > drivers/mailbox/mtk-cmdq-mailbox.c | 2 ++ > > include/linux/mailbox/mtk-cmdq-mailbox.h | 1 + > > 2 files changed, 3 insertions(+) > > > > diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c > > index ef59e2234f22..99a9e0787501 100644 > > --- a/drivers/mailbox/mtk-cmdq-mailbox.c > > +++ b/drivers/mailbox/mtk-cmdq-mailbox.c > > @@ -188,6 +188,7 @@ 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; > > + data.pkt = task->pkt; > > if (cb->cb) > > cb->cb(data); > > > > @@ -456,6 +457,7 @@ static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout) > > list_entry) { > > data.sta = -ECONNABORTED; > > data.data = cb->data; > > + data.pkt = task->pkt; > > cb = &task->pkt->async_cb; > > if (cb->cb) > > cb->cb(data); > > diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h > > index 2f7d9a37d611..44365aab043c 100644 > > --- a/include/linux/mailbox/mtk-cmdq-mailbox.h > > +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h > > @@ -68,6 +68,7 @@ enum cmdq_code { > > struct cmdq_cb_data { > > int sta; > > void *data; > > + struct cmdq_pkt *pkt; > > }; > > > > typedef void (*cmdq_async_flush_cb)(struct cmdq_cb_data data); > > -- > > 2.17.1 > >
diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index ef59e2234f22..99a9e0787501 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -188,6 +188,7 @@ 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; + data.pkt = task->pkt; if (cb->cb) cb->cb(data); @@ -456,6 +457,7 @@ static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout) list_entry) { data.sta = -ECONNABORTED; data.data = cb->data; + data.pkt = task->pkt; cb = &task->pkt->async_cb; if (cb->cb) cb->cb(data); diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h index 2f7d9a37d611..44365aab043c 100644 --- a/include/linux/mailbox/mtk-cmdq-mailbox.h +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h @@ -68,6 +68,7 @@ enum cmdq_code { struct cmdq_cb_data { int sta; void *data; + struct cmdq_pkt *pkt; }; typedef void (*cmdq_async_flush_cb)(struct cmdq_cb_data data);
Current client use 'struct cmdq_pkt' as callback data, so change 'void *data' to 'struct cmdq_pkt *pkt'. Keep data until client use pkt instead of data. Cc: Jassi Brar <jassisinghbrar@gmail.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Houlong Wei <houlong.wei@mediatek.com> Cc: Bibby Hsieh <bibby.hsieh@mediatek.com> Cc: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com> Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> --- drivers/mailbox/mtk-cmdq-mailbox.c | 2 ++ include/linux/mailbox/mtk-cmdq-mailbox.h | 1 + 2 files changed, 3 insertions(+)