diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2017-01-09 06:25:44 -0500 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2017-01-18 09:21:10 -0500 |
commit | 75bcb0545b56eab2d69dbccf95ff7505b7114e5d (patch) | |
tree | 27a72719e641dfea4ab47ad8302d2b7421538019 | |
parent | ea441bd33f93aa7f6f404c8877e6d3313a4dbdbe (diff) |
drm: tegra: use crtc helper drm_crtc_from_index()
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
-rw-r--r-- | drivers/gpu/drm/tegra/drm.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 0f4eacb0af4f..2d57f6278db1 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c | |||
@@ -804,23 +804,10 @@ static const struct file_operations tegra_drm_fops = { | |||
804 | .llseek = noop_llseek, | 804 | .llseek = noop_llseek, |
805 | }; | 805 | }; |
806 | 806 | ||
807 | static struct drm_crtc *tegra_crtc_from_pipe(struct drm_device *drm, | ||
808 | unsigned int pipe) | ||
809 | { | ||
810 | struct drm_crtc *crtc; | ||
811 | |||
812 | list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) { | ||
813 | if (pipe == drm_crtc_index(crtc)) | ||
814 | return crtc; | ||
815 | } | ||
816 | |||
817 | return NULL; | ||
818 | } | ||
819 | |||
820 | static u32 tegra_drm_get_vblank_counter(struct drm_device *drm, | 807 | static u32 tegra_drm_get_vblank_counter(struct drm_device *drm, |
821 | unsigned int pipe) | 808 | unsigned int pipe) |
822 | { | 809 | { |
823 | struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe); | 810 | struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe); |
824 | struct tegra_dc *dc = to_tegra_dc(crtc); | 811 | struct tegra_dc *dc = to_tegra_dc(crtc); |
825 | 812 | ||
826 | if (!crtc) | 813 | if (!crtc) |
@@ -831,7 +818,7 @@ static u32 tegra_drm_get_vblank_counter(struct drm_device *drm, | |||
831 | 818 | ||
832 | static int tegra_drm_enable_vblank(struct drm_device *drm, unsigned int pipe) | 819 | static int tegra_drm_enable_vblank(struct drm_device *drm, unsigned int pipe) |
833 | { | 820 | { |
834 | struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe); | 821 | struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe); |
835 | struct tegra_dc *dc = to_tegra_dc(crtc); | 822 | struct tegra_dc *dc = to_tegra_dc(crtc); |
836 | 823 | ||
837 | if (!crtc) | 824 | if (!crtc) |
@@ -844,7 +831,7 @@ static int tegra_drm_enable_vblank(struct drm_device *drm, unsigned int pipe) | |||
844 | 831 | ||
845 | static void tegra_drm_disable_vblank(struct drm_device *drm, unsigned int pipe) | 832 | static void tegra_drm_disable_vblank(struct drm_device *drm, unsigned int pipe) |
846 | { | 833 | { |
847 | struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe); | 834 | struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe); |
848 | struct tegra_dc *dc = to_tegra_dc(crtc); | 835 | struct tegra_dc *dc = to_tegra_dc(crtc); |
849 | 836 | ||
850 | if (crtc) | 837 | if (crtc) |