From patchwork Thu May 11 19:10:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9722777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0BA1D60236 for ; Thu, 11 May 2017 19:11:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0E1528702 for ; Thu, 11 May 2017 19:11:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E548D28704; Thu, 11 May 2017 19:11:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 75F4828702 for ; Thu, 11 May 2017 19:11:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E9BF6E5C9; Thu, 11 May 2017 19:11:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-f194.google.com (mail-qt0-f194.google.com [209.85.216.194]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E80C6E5C5 for ; Thu, 11 May 2017 19:11:10 +0000 (UTC) Received: by mail-qt0-f194.google.com with SMTP id j13so4055116qta.3 for ; Thu, 11 May 2017 12:11:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XWIFPGL/xHtsGTLGgAWPZ8LwbouSuCGUxy1ohtxOm9I=; b=HR6R0OpvfCQVvbjlyD/MUzAODOrh0+ks6EJKohQ98NiT74yB+q/cPoeEtrLrWdRDRl lXDaD/uuh6Omv8TJtszHin9mws04VBQeEG30e09OZniIjMovOROGaLMoIA1Cy61FK1e5 kLLP0uOpJO3NrhNNbWSg5v6/VqE57ito6tt4eQ9/YA1sQ1F84RGY/VL+BWVNhSjzC2A4 Xaw0gRPsU3t9b2KtU+a4XwGmGqxcDrje4nkkLMffdme8OI4CR6l91uxgO4qxJFVdymlA F/m+sm0hLDdZi9m0qtqplfF2yZF4TLX4i4Uy08AjDgv4S5dxErSneQF2AvGG4i0ltcp4 8Ynw== X-Gm-Message-State: AODbwcCzy/JOvaFrL4lULVYDTqG9DOSpHVmbzed2nDd9Tasc8wz5Qvd4 XmJ9MNnvI2gtbw== X-Received: by 10.200.3.195 with SMTP id z3mr84538qtg.185.1494529869829; Thu, 11 May 2017 12:11:09 -0700 (PDT) Received: from localhost.localdomain (177.205.87.164.dynamic.adsl.gvt.net.br. [177.205.87.164]) by smtp.gmail.com with ESMTPSA id z43sm726708qtz.9.2017.05.11.12.11.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 May 2017 12:11:09 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/8] drm/mediatek: use drm_for_each_connector_iter() Date: Thu, 11 May 2017 16:10:45 -0300 Message-Id: <20170511191049.28944-5-gustavo@padovan.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170511191049.28944-1-gustavo@padovan.org> References: <20170511191049.28944-1-gustavo@padovan.org> Cc: Gustavo Padovan X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan Drop legacy drm_for_each_connector() in favor of the race-free drm_for_each_connector_iter(). Cc: Philipp Zabel Signed-off-by: Gustavo Padovan Reviewed-by: Daniel Vetter --- 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; } + drm_connector_list_iter_end(&conn_iter); } ret = pm_runtime_get_sync(crtc->dev->dev);