[PATCH 8/9] drm/mediatek: Do not store struct cmdq_client in struct cmdq_pkt

Chun-Kuang Hu posted 9 patches 9 months ago
There is a newer version of this series
[PATCH 8/9] drm/mediatek: Do not store struct cmdq_client in struct cmdq_pkt
Posted by Chun-Kuang Hu 9 months ago
MediaTek drm driver has the struct cmdq_client information, so
it's not necessary to store this information in struct cmdq_pkt.

Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index df693fa268ce..0d54cbefee0b 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -123,7 +123,6 @@ static int mtk_drm_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *
 		return -ENOMEM;
 
 	pkt->buf_size = size;
-	pkt->cl = (void *)client;
 
 	dev = client->chan->mbox->dev;
 	dma_addr = dma_map_single(dev, pkt->va_base, pkt->buf_size,
@@ -139,10 +138,8 @@ static int mtk_drm_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *
 	return 0;
 }
 
-static void mtk_drm_cmdq_pkt_destroy(struct cmdq_pkt *pkt)
+static void mtk_drm_cmdq_pkt_destroy(struct cmdq_client *client, struct cmdq_pkt *pkt)
 {
-	struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
-
 	dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size,
 			 DMA_TO_DEVICE);
 	kfree(pkt->va_base);
@@ -156,7 +153,7 @@ static void mtk_drm_crtc_destroy(struct drm_crtc *crtc)
 
 	mtk_mutex_put(mtk_crtc->mutex);
 #if IS_REACHABLE(CONFIG_MTK_CMDQ)
-	mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_handle);
+	mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_client, &mtk_crtc->cmdq_handle);
 
 	if (mtk_crtc->cmdq_client.chan) {
 		mbox_free_channel(mtk_crtc->cmdq_client.chan);
-- 
2.34.1
Re: [PATCH 8/9] drm/mediatek: Do not store struct cmdq_client in struct cmdq_pkt
Posted by AngeloGioacchino Del Regno 9 months ago
Il 15/02/24 01:49, Chun-Kuang Hu ha scritto:
> MediaTek drm driver has the struct cmdq_client information, so
> it's not necessary to store this information in struct cmdq_pkt.
> 
> Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>

As said in patch [1/9], this should be done in the common function, not in each
copy-pasted function in mtk_drm and mtk-mdp3.

Regards,
Angelo