[PATCH 4/8] drm/mediatek: use drm_for_each_connector_iter()
Daniel Vetter
daniel at ffwll.ch
Fri May 12 07:44:23 UTC 2017
On Thu, May 11, 2017 at 04:10:45PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan at collabora.com>
>
> Drop legacy drm_for_each_connector() in favor of the race-free
> drm_for_each_connector_iter().
>
> Cc: Philipp Zabel <p.zabel at pengutronix.de>
> Signed-off-by: Gustavo Padovan <gustavo.padovan at collabora.com>
>
> ---
> only built-tested!
> ---
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 6b08774..6582e1f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -221,6 +221,7 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)
> struct drm_crtc *crtc = &mtk_crtc->base;
> struct drm_connector *connector;
> struct drm_encoder *encoder;
> + struct drm_connector_list_iter conn_iter;
> unsigned int width, height, vrefresh, bpc = MTK_MAX_BPC;
> int ret;
> int i;
> @@ -237,13 +238,15 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)
> if (encoder->crtc != crtc)
> continue;
>
> - drm_for_each_connector(connector, crtc->dev) {
> + drm_connector_list_iter_begin(crtc->dev, &conn_iter);
> + drm_for_each_connector_iter(connector, &conn_iter) {
> if (connector->encoder != encoder)
> continue;
> if (connector->display_info.bpc != 0 &&
> bpc > connector->display_info.bpc)
> bpc = connector->display_info.bpc;
Computing bpc here is probably a bug, should be done in atomic_check most
likely. But there's already a todo about this.
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> }
> + drm_connector_list_iter_end(&conn_iter);
> }
>
> ret = pm_runtime_get_sync(crtc->dev->dev);
> --
> 2.9.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list