drm: nouveau: use crtc helper drm_crtc_from_index()

Use drm_crtc_from_index() to find drm_crtc for given index.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1483961145-18453-5-git-send-email-shawnguo@kernel.org
This commit is contained in:
Shawn Guo 2017-01-09 19:25:43 +08:00 коммит произвёл Sean Paul
Родитель ffec892583
Коммит ea441bd33f
1 изменённых файлов: 18 добавлений и 15 удалений

Просмотреть файл

@ -58,27 +58,30 @@ int
nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe) nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe)
{ {
struct drm_crtc *crtc; struct drm_crtc *crtc;
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct nouveau_crtc *nv_crtc;
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
if (nv_crtc->index == pipe) { crtc = drm_crtc_from_index(dev, pipe);
nvif_notify_get(&nv_crtc->vblank); if (!crtc)
return 0; return -EINVAL;
}
} nv_crtc = nouveau_crtc(crtc);
return -EINVAL; nvif_notify_get(&nv_crtc->vblank);
return 0;
} }
void void
nouveau_display_vblank_disable(struct drm_device *dev, unsigned int pipe) nouveau_display_vblank_disable(struct drm_device *dev, unsigned int pipe)
{ {
struct drm_crtc *crtc; struct drm_crtc *crtc;
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct nouveau_crtc *nv_crtc;
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
if (nv_crtc->index == pipe) { crtc = drm_crtc_from_index(dev, pipe);
nvif_notify_put(&nv_crtc->vblank); if (!crtc)
return; return;
}
} nv_crtc = nouveau_crtc(crtc);
nvif_notify_put(&nv_crtc->vblank);
} }
static inline int static inline int