drm: tegra: use crtc helper drm_crtc_from_index()
authorShawn Guo <shawn.guo@linaro.org>
Mon, 9 Jan 2017 11:25:44 +0000 (19:25 +0800)
committerSean Paul <seanpaul@chromium.org>
Wed, 18 Jan 2017 14:21:10 +0000 (09:21 -0500)
Function tegra_crtc_from_pipe() does the exactly same thing as what
crtc helper drm_crtc_from_index() provides.  Use the helper to save
some code.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1483961145-18453-6-git-send-email-shawnguo@kernel.org
drivers/gpu/drm/tegra/drm.c

index 0f4eacb0af4f5da4126e64fa1872be9a3f88e0c4..2d57f6278db19a8101f0867a8de3693e0b3c2ca5 100644 (file)
@@ -804,23 +804,10 @@ static const struct file_operations tegra_drm_fops = {
        .llseek = noop_llseek,
 };
 
-static struct drm_crtc *tegra_crtc_from_pipe(struct drm_device *drm,
-                                            unsigned int pipe)
-{
-       struct drm_crtc *crtc;
-
-       list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) {
-               if (pipe == drm_crtc_index(crtc))
-                       return crtc;
-       }
-
-       return NULL;
-}
-
 static u32 tegra_drm_get_vblank_counter(struct drm_device *drm,
                                        unsigned int pipe)
 {
-       struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe);
+       struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
        struct tegra_dc *dc = to_tegra_dc(crtc);
 
        if (!crtc)
@@ -831,7 +818,7 @@ static u32 tegra_drm_get_vblank_counter(struct drm_device *drm,
 
 static int tegra_drm_enable_vblank(struct drm_device *drm, unsigned int pipe)
 {
-       struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe);
+       struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
        struct tegra_dc *dc = to_tegra_dc(crtc);
 
        if (!crtc)
@@ -844,7 +831,7 @@ static int tegra_drm_enable_vblank(struct drm_device *drm, unsigned int pipe)
 
 static void tegra_drm_disable_vblank(struct drm_device *drm, unsigned int pipe)
 {
-       struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe);
+       struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe);
        struct tegra_dc *dc = to_tegra_dc(crtc);
 
        if (crtc)