Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1726297pxb; Thu, 7 Oct 2021 13:51:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRLXtbmVqp0xn7IKwioeJ9ZTRMaj4zFpeLqZyUvllZtQ6FwWHrea64HM4HjG4PkdUHPrCq X-Received: by 2002:a05:6402:485:: with SMTP id k5mr9099561edv.257.1633639905466; Thu, 07 Oct 2021 13:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633639905; cv=none; d=google.com; s=arc-20160816; b=GjQdoK06FwMIEzM3r/NRPBiYsmcjJ0FeuKM7wppxsAr60WbOyUy9iplGQJkpLDrY5p aN9om9SKGJ9u8sHgG42cByDnr901eR9kJsSovQFF0B5wkU4J6SLUzZWoaGK9NMtivsZf hJM1Jj+eG6xjPsMq9Czx4w6f1LdFUW1ADk5WriBvtQHV7jWet5DiGVUfENdKg7d4t2V3 hf1/t4Upm2OfMu33WzenhBb+Ge494xKN1S3UuwHUxYNHmvB2v4ojmk9USiL4vzFRgEU5 gAPhp+JmkZDDY641NMng/3VN2YxdZ5FKAwn/5GAJP+PuRy4Gu+mYGQYfQUnJbHndoq83 fnGw== 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=hN+Omdwh/ZXHzIUZMrVYLJfHaaHrkz3CkpBOmM66CeE4WIUtI8V2W8Pjbmu32gySSd LDj7Vdx/mjqtaeqnN0qiBvzrxwPyxi6D+10qHpI7h1RK45o11/mLJ0iKeJ40lyyz+Q9D TUhbChGZpeoe8Aukp1gZB0iCn+w66ETlL3+nPtP7NdqoTNepSQH+3tfPru5USw7MgMGQ YraaFPxmAFMVKSwXXQB2W0VtpCQ00Js5mDRZGv/9pvAua3uP/XKF6PpzmCNH7/MD02dU /klnponYMHWea0273GeYeEmqlrw+6EaQLt2CtT6W7j7ZMa+KnKHDZkcoZJoLHbAQ5Sqg 2pxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@u92.eu header.s=fm3 header.b=VDzwGlZU; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ZInB0Zcw; 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 h2si487099ejj.419.2021.10.07.13.51.22; Thu, 07 Oct 2021 13:51:45 -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=VDzwGlZU; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=ZInB0Zcw; 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 S233405AbhJGTlU (ORCPT + 99 others); Thu, 7 Oct 2021 15:41:20 -0400 Received: from wnew1-smtp.messagingengine.com ([64.147.123.26]:56689 "EHLO wnew1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242390AbhJGTlF (ORCPT ); Thu, 7 Oct 2021 15:41:05 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id A63AC2B009FD; Thu, 7 Oct 2021 15:39:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 07 Oct 2021 15:39:11 -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=VDzwGlZUj9E0/kUffXLcn+b1Dz31b WWII+RBaYfFFYujWIBUlex+FvIm2zHu0+YbQe0shxYLXGmHM6mX3pQI7TBk2yb8j 8fwHjT7TqLXVr7MJT2glgzzoQneqQzrHjYAkEY59UwfQficn1RouSwzdS5FPkRcQ ppiW2UuGDpTlTH+EKsWrA2hKbFRcXPjoxkbuqIcv0cvFO52Plg3y4cwZFSkvdbM4 BtrAd29lf6JZAf2SuFpSRWrHKVxnM4efCs/vCW68ArP4ftAk9WwskhCpIwUrvss8 4xJ1JdEhCjY977qASaP5n3OMcsamoGHWd8bmaYJ7yiidtth2cxoGrvHHg== 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=ZInB0Zcw bUlSBgkrGOyiCxagNgUBVe1I1NVChJIrf3nhz3FDeZLkxf/Ad38bkl916fk3u6js dIFPzyj21gY+Hiu8tkDerctNXEvQs/KblK6AOr6HTSJ8EYAGZturqUpoMDItrRxZ srKNOOQd2fKBOoxbpuxJi907xPolBuDvrIJKO2canFM/I8WllQinTils9aoX6DcC HHNYCYE6b7hzzxSvlhiMoabBeVCegrQZHsXSrfJuzqZg6egscYXRCI1uYO9aEBcI i3DUQWUmslxdY51RA++RlRWT1YSDcgZbg50444kAHQYJlTOGroJZrgthPJou/m8R Alku8tvCr0VHJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudelkedgudefjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefhvghrnhgrnhguohcutfgrmhhoshcuoehgrhgvvghnfhho ohesuhelvddrvghuqeenucggtffrrghtthgvrhhnpeekleekjedtheejheekfefggeevvd fgueegffeuveduhfehueegkeeijedvvdejfeenucevlhhushhtvghrufhiiigvpeegnecu rfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvvghnfhhoohesuhelvddrvghu X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 7 Oct 2021 15:39:07 -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 v3 16/20] drm/amd: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN() Date: Thu, 7 Oct 2021 21:37:51 +0200 Message-Id: <20211007193755.29579-17-greenfoo@u92.eu> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211007193755.29579-1-greenfoo@u92.eu> References: <20211007193755.29579-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