drm: mediatek: use crtc helper drm_crtc_from_index()
authorShawn Guo <shawn.guo@linaro.org>
Mon, 9 Jan 2017 11:25:42 +0000 (19:25 +0800)
committerSean Paul <seanpaul@chromium.org>
Wed, 18 Jan 2017 14:21:06 +0000 (09:21 -0500)
Use drm_crtc_from_index() to find drm_crtc for given index, so that we
do not need to maintain a pointer array in struct mtk_drm_private.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1483961145-18453-4-git-send-email-shawnguo@kernel.org
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
drivers/gpu/drm/mediatek/mtk_drm_drv.h

index 01a21dd835b57c865ba685f560aa204d19f7a636..a73de1e669c24832fffa4a30b664bff0461b398e 100644 (file)
@@ -170,8 +170,8 @@ static void mtk_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 
 int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe)
 {
-       struct mtk_drm_private *priv = drm->dev_private;
-       struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(priv->crtc[pipe]);
+       struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
+       struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
        struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0];
 
        mtk_ddp_comp_enable_vblank(ovl, &mtk_crtc->base);
@@ -181,8 +181,8 @@ int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe)
 
 void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe)
 {
-       struct mtk_drm_private *priv = drm->dev_private;
-       struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(priv->crtc[pipe]);
+       struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
+       struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
        struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0];
 
        mtk_ddp_comp_disable_vblank(ovl);
@@ -588,7 +588,6 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
                goto unprepare;
        drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE);
        drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, false, MTK_LUT_SIZE);
-       priv->crtc[pipe] = &mtk_crtc->base;
        priv->num_pipes++;
 
        return 0;
index aa9389446785f5115f9d24fb34919bb7f9dc6deb..df322a7a5fcbede3f24920c7265b8b7843abef7e 100644 (file)
@@ -32,7 +32,6 @@ struct mtk_drm_private {
        struct drm_device *drm;
        struct device *dma_dev;
 
-       struct drm_crtc *crtc[MAX_CRTC];
        unsigned int num_pipes;
 
        struct device_node *mutex_node;