From patchwork Fri May 12 16:41:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9724587 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 862E9601E7 for ; Fri, 12 May 2017 16:41:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E5842885A for ; Fri, 12 May 2017 16:41:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 632782885E; Fri, 12 May 2017 16:41:17 +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 EF4B22885A for ; Fri, 12 May 2017 16:41:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21F5E6E0FE; Fri, 12 May 2017 16:41:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-f193.google.com (mail-qk0-f193.google.com [209.85.220.193]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34C146E118 for ; Fri, 12 May 2017 16:41:12 +0000 (UTC) Received: by mail-qk0-f193.google.com with SMTP id y128so8489768qka.3 for ; Fri, 12 May 2017 09:41:12 -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=g6y0kmJ9X3D5C5di8fyjxK51sz05VDgCOsdb7D7vpPs=; b=AVym1Tb30+WZC5KOtQ17Eo1/J8ygS1fZd02SnBQtA9LYeUpvh1o6nQvRf2ai7bIUER 7Q6etM5oJXIdL8h3pOEe9fc6AwiLDuMhGdtZCVwaAd2wJJZfKjvgKggZCBtF3SipZz++ OSCRU/eoUhcxKKGv1yFtDgyPUZ6fzwKDAVrwht+V04fI1JImjL5kVigDkob260TeMP4K SFGz4hqtJ1l1a7pbG2nf0PfD5kLMXlux2KBFBMUe8U8dHk3Shm8Dd1JoCpe56lgNE+Fg MYxPj6z1ITJfJFHNYZ/ANu2nCfmcEkkjgQxpZOkyx8T8kW2SMejjcUt03WCFn8J5DOTV btOQ== X-Gm-Message-State: AODbwcAPDQN/CJT+g1IllzDDQidqwnDLlZdsk3jcC/ZE7sEJPT7u87AV 0+0VKGxQfA3W1A== X-Received: by 10.55.115.67 with SMTP id o64mr4388595qkc.216.1494607271384; Fri, 12 May 2017 09:41:11 -0700 (PDT) Received: from localhost.localdomain ([177.17.166.160]) by smtp.gmail.com with ESMTPSA id i51sm2626840qte.28.2017.05.12.09.41.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 May 2017 09:41:10 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm/vc4: use drm_for_each_connector_iter() Date: Fri, 12 May 2017 13:41:00 -0300 Message-Id: <20170512164100.7649-1-gustavo@padovan.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170511191049.28944-7-gustavo@padovan.org> References: <20170511191049.28944-7-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(). v2: add missing drm_connector_list_iter_end(Daniel Vetter) Cc: Eric Anholt Signed-off-by: Gustavo Padovan Reviewed-by: Daniel Vetter Acked-by: Eric Anholt --- only built-tested! --- drivers/gpu/drm/vc4/vc4_crtc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index d86c8cc..d66345f 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -359,12 +359,16 @@ static u32 vc4_get_fifo_full_level(u32 format) static struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc) { struct drm_connector *connector; + struct drm_connector_list_iter conn_iter; - 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->state->crtc == crtc) { + drm_connector_list_iter_end(&conn_iter); return connector->encoder; } } + drm_connector_list_iter_end(&conn_iter); return NULL; }