From patchwork Thu May 11 19:10:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9722771 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 4D9B860236 for ; Thu, 11 May 2017 19:11:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EB1428701 for ; Thu, 11 May 2017 19:11:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 318B828703; Thu, 11 May 2017 19:11:05 +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 865C228701 for ; Thu, 11 May 2017 19:11:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D4AF56E5BA; Thu, 11 May 2017 19:11:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) by gabe.freedesktop.org (Postfix) with ESMTPS id E13B66E5BA for ; Thu, 11 May 2017 19:11:01 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id j13so4054633qta.3 for ; Thu, 11 May 2017 12:11:01 -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=A9dJ1ywzrdB+OPZTlrllPcVbOW5gU3UzpKD5LdgDm8Q=; b=MT8sEorTN3nR35uD/jMN3tzRwM8CfD0Z1zneVwQpNg9Da5p4P3UsmqRhZfoAq9GgMz ECTl5eIMqpe3X+GLhZPwj+vsCkTCAIZ9RAkf1Km4dNFEmEq/pG+jY6rwyQsAXTKTtar4 Y8htkNCqUti/k8U10nRUDCHsrRsUFhQn1MK2ARsvKZdMtzAmK/eiA5AZ8ehy24tMUIMT 5DtQW63Qef1lz+2bPLW8iuKv02aHjjss4vCg06qsAwlshwQ8VQF+G+c5wUDZPeNmKl3t tsfmwVuFH1yN2SmsEV8RUyD5JIRchGRbEnsg9tjxR2j8v14wOkG9XGEI67CJCb04b9Hh DdPA== X-Gm-Message-State: AODbwcB4J2xyv0qjRenmjKv+pipwRTdCH70P8CJpb3BVz7WqdythHaZM 7jubHrQkcX8LAw== X-Received: by 10.237.62.200 with SMTP id o8mr116064qtf.152.1494529861116; Thu, 11 May 2017 12:11:01 -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.10.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 May 2017 12:11:00 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/8] drm/exynos: use drm_for_each_connector_iter() Date: Thu, 11 May 2017 16:10:42 -0300 Message-Id: <20170511191049.28944-2-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: Inki Dae Cc: Joonyoung Shim Signed-off-by: Gustavo Padovan Reviewed-by: Daniel Vetter --- only built-tested! --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 09d3c4c..db6ef2d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -177,12 +177,13 @@ static int exynos_drm_suspend(struct device *dev) { struct drm_device *drm_dev = dev_get_drvdata(dev); struct drm_connector *connector; + struct drm_connector_list_iter conn_iter; if (pm_runtime_suspended(dev) || !drm_dev) return 0; - drm_modeset_lock_all(drm_dev); - drm_for_each_connector(connector, drm_dev) { + drm_connector_list_iter_begin(drm_dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { int old_dpms = connector->dpms; if (connector->funcs->dpms) @@ -191,7 +192,7 @@ static int exynos_drm_suspend(struct device *dev) /* Set the old mode back to the connector for resume */ connector->dpms = old_dpms; } - drm_modeset_unlock_all(drm_dev); + drm_connector_list_iter_end(&conn_iter); return 0; } @@ -200,12 +201,13 @@ static int exynos_drm_resume(struct device *dev) { struct drm_device *drm_dev = dev_get_drvdata(dev); struct drm_connector *connector; + struct drm_connector_list_iter conn_iter; if (pm_runtime_suspended(dev) || !drm_dev) return 0; - drm_modeset_lock_all(drm_dev); - drm_for_each_connector(connector, drm_dev) { + drm_connector_list_iter_begin(drm_dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { if (connector->funcs->dpms) { int dpms = connector->dpms; @@ -213,7 +215,7 @@ static int exynos_drm_resume(struct device *dev) connector->funcs->dpms(connector, dpms); } } - drm_modeset_unlock_all(drm_dev); + drm_connector_list_iter_end(&conn_iter); return 0; }