Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3827071pxb; Wed, 13 Oct 2021 13:54:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziN5unT6jK6yz2cfiiG2PQdHOG3D//ceTprm+rrKxMO2NArHg4O9OkrVtiwcGKk/4lk/cF X-Received: by 2002:a17:906:4c55:: with SMTP id d21mr1750665ejw.397.1634158490963; Wed, 13 Oct 2021 13:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634158490; cv=none; d=google.com; s=arc-20160816; b=hiyndZLKRWzY/QbLOrW53FB1Ms2OvwInxQgwI5YRGEm6+xFn8C9JV9OZqHVsT/oZmH QN0Uj1YLIjNH4n7IJyPC9gW4HwOdbeuy3o4PXQ8yzM7m9tZFLE5ZNWHjHWJR/8qZaKG+ zkbuUqi26YO/sUs+PIefRnBU8iX2ME9aIIH0yzAjn1bexrecR5cA+ZUalCP0uaTs1W38 1NRgxIPloNWz2vgDHzEd6A69u7T641eyAosQ78RGhGsC1toWiEqRJ9gxBJ1YDO146qj2 OlSFfAZn3+M2W0k5H5jTW1pW+RG6YTpfdoUvAD6+VLbZ10wekh+lHPVNfxfxIY/aoUAp d8Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=/243izJfdBfCxxS8dW6rDyb++C/dKdNlrRpQoNqLOqA=; b=vZxB1yCByQ/TSDdHistGLlYrm5s1YYtx1vA/qtfELRI+5CyXt6oMePed4J6HleJOWs j/RiQiqTzAOuCz2QlkZ1EKXqj3or4me88KfqgXNUGzY5lRkO3EaZYWPvwICXxOy0rBFR tVJlDuULMWn0WWpv7wpMkTxnHC9lOdbyKipLtzvKCTI8HkRu5tF/xntix2ouvyC+8yK0 UUpWwWgQ6cSwb2nPBd8bX1KNr4L1RWdAwzbaJUH1ftxC05kUHf5+/exZ8x/f86h/MTUz tjXNowbNXLK3Gt3fmADdcmgeifJLIm4eMXcgPri+uw6Nxn2c2SFSTlG0F9WPrn6wDw/s eD2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@u92.eu header.s=fm3 header.b=YJuKD0Qu; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ids1+tQK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si898989ejw.689.2021.10.13.13.54.27; Wed, 13 Oct 2021 13:54:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@u92.eu header.s=fm3 header.b=YJuKD0Qu; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ids1+tQK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230409AbhJMUwE (ORCPT + 99 others); Wed, 13 Oct 2021 16:52:04 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:55823 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbhJMUvo (ORCPT ); Wed, 13 Oct 2021 16:51:44 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 8ED99581177; Wed, 13 Oct 2021 16:49:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 13 Oct 2021 16:49:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u92.eu; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=/243izJfdBfCx xS8dW6rDyb++C/dKdNlrRpQoNqLOqA=; b=YJuKD0QuJx3Lq5JCg9E04s6U7jzmO Ox6P4Zz54+85sPqYMiYr/kvnYCwQkvadIQ30rrxsZIHZI4u5vXVum8j7QgTJPrd5 fqEaDcZ9EP3T4ER1IREbXedSek/4LcHsM8qVzG490P5ReBZau6Gczh2cnsROISWc gcE4P5eLeZzZxfk2TV4kWcdnQeHWwHc2aLqhKcig2jogG5ZLRD/SzgGbyibRIO6q i1YDOI3YMradn6pLIv+hdu365DCuFetuFIN8miSGVPpvUV+/W7pckGeXW+PwbddB U8AK0texfGwZvLIqAHGN2FzG83f70jJaeiykgDkEfdO+Pe1Ow0/1XMKvA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=/243izJfdBfCxxS8dW6rDyb++C/dKdNlrRpQoNqLOqA=; b=ids1+tQK xiSfrTHhRF96kOPVi5Is7ldJ3UcMOwoDfwbf6eHUbqY5ZHW3oTaPz0RhtYrYmzB3 +LZrFyH4CEBkllo/Tsbf3ltwVqDr+QF2SUAFuMM5WTUFH7JifGx+GUbc8T74cJVE 2z8x2r8m/vJxokz2H4Eyss5/Ly6Htz3JDsUSZiovNAZwhz4LevZuz5jKHwFky2L6 PMZ23ifH/5MDuWXOXnL52lw1DeADokF55qLfhjXRdleXLsPn0eNj8gzGh7JxLUGC M2RtY5cSjjNXcQziWS+tDL89ZWwfAGF9v5HKEX5WzMo88lI55XDZ1grbh0ikkoVY ouDiZC/li0vIBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddutddgudehudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefhvghrnhgrnhguohcutfgrmhhoshcuoehgrhgvvghnfhho ohesuhelvddrvghuqeenucggtffrrghtthgvrhhnpeekleekjedtheejheekfefggeevvd fgueegffeuveduhfehueegkeeijedvvdejfeenucevlhhushhtvghrufhiiigvpedunecu rfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvvghnfhhoohesuhelvddrvghu X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Oct 2021 16:49:37 -0400 (EDT) From: Fernando Ramos To: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, sean@poorly.run, linux-doc@vger.kernel.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v4 16/20] drm/amd: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN() Date: Wed, 13 Oct 2021 22:48:42 +0200 Message-Id: <20211013204846.90026-17-greenfoo@u92.eu> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211013204846.90026-1-greenfoo@u92.eu> References: <20211013204846.90026-1-greenfoo@u92.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As requested in Documentation/gpu/todo.rst, replace driver calls to drm_modeset_lock_all() with DRM_MODESET_LOCK_ALL_BEGIN() and DRM_MODESET_LOCK_ALL_END() Signed-off-by: Fernando Ramos --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index dc50c05f23fc..0ea7bdbc8482 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -40,6 +40,7 @@ #include #include #include +#include static void amdgpu_display_flip_callback(struct dma_fence *f, struct dma_fence_cb *cb) @@ -1574,16 +1575,21 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev) struct drm_crtc *crtc; struct drm_connector *connector; struct drm_connector_list_iter iter; - int r; + struct drm_modeset_acquire_ctx ctx; + int r, ret; /* turn off display hw */ - drm_modeset_lock_all(dev); + DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret); drm_connector_list_iter_begin(dev, &iter); drm_for_each_connector_iter(connector, &iter) drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); drm_connector_list_iter_end(&iter); - drm_modeset_unlock_all(dev); + DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); + + if (ret) + return ret; + /* unpin the front buffers and cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); @@ -1621,7 +1627,8 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev) struct drm_connector *connector; struct drm_connector_list_iter iter; struct drm_crtc *crtc; - int r; + struct drm_modeset_acquire_ctx ctx; + int r, ret; /* pin cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { @@ -1643,7 +1650,7 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev) drm_helper_resume_force_mode(dev); /* turn on display hw */ - drm_modeset_lock_all(dev); + DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret); drm_connector_list_iter_begin(dev, &iter); drm_for_each_connector_iter(connector, &iter) @@ -1651,8 +1658,8 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev) DRM_MODE_DPMS_ON); drm_connector_list_iter_end(&iter); - drm_modeset_unlock_all(dev); + DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); - return 0; + return ret; } -- 2.33.0