Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4343302pxy; Tue, 27 Apr 2021 02:47:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKM6MCuNI/DLaaxI4n1oKm2PRpzcfCHmDDXFVGPssuKiMHJET5xbODSHz/E+QQZK4G+vKu X-Received: by 2002:a62:d108:0:b029:25d:497e:2dfd with SMTP id z8-20020a62d1080000b029025d497e2dfdmr22685978pfg.29.1619516870662; Tue, 27 Apr 2021 02:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619516870; cv=none; d=google.com; s=arc-20160816; b=vRzK6vQa3vSDtLb5sfgbubQQ6uOxfGU2Cs+7PlZ34WXlDlkwRPUds+mWJ9yRCFYFiN WRaW/l/UOccDMmGcPPUuu8CpPvzjqLuiTt8zyDrcsRK+JsYbLZsbAgDNgz+Qo+pnmgUJ YCTqEG3VIl1k0rJ0r9SSJ6k6FiSqVFkfEX+Ki1DGpgijSF7u+xOdMCji8orc9kiA9iZS ZOPFe4XHD8akauTSMUDU/ZiHke/toOiIpPcd8hn0yEpHwuz1I0uDd8o10OdvuWqF/WTA lTh+V+pqtYvg/ykW1UtbaT1xZJuAFCiX7i3XJ34qUXqcWxDwi1NF2nPtQ+4RDKM/99K4 QYFw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=n42LGu+VcJUysptGCXvSA/WZLd2LrRzztiVguwQc09Q=; b=RFy2+0PRjn3cJ6GzsfWDrpDYCi6NFCx+Da7S3veThIxwKxi24RsfM/vC8Li18zIcsL SEn1AYBjtYo/53twvkaFKV0spMyy8rH0YoDgGrfWDqSXg0o6omE/W5aDZLqLQqFrGQ/c qWibCeLFflD9z4pySsz+YSI2HW1u7TTwFA4AqZ63B16akWIgSSMpVdT2pmjh4mxpk2wj NQSeJD1kvQlijLGhxQMJIPpMx3CHgZRF2+mRFdUmdks0zZqQJVQFEg3c7a/vyMW357fv O5rEZPBvbmpvJJk4bvhSg8ucomUhBCFPRqeAzLctnCH7aYYiVfSwRrDRpgzjj3hSUieV 90Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XnxbtZIP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j76si3351336pfd.225.2021.04.27.02.47.36; Tue, 27 Apr 2021 02:47: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=@gmail.com header.s=20161025 header.b=XnxbtZIP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235192AbhD0JqC (ORCPT + 99 others); Tue, 27 Apr 2021 05:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235181AbhD0Jp5 (ORCPT ); Tue, 27 Apr 2021 05:45:57 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B1ACC061756 for ; Tue, 27 Apr 2021 02:44:57 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id h10so69155620edt.13 for ; Tue, 27 Apr 2021 02:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n42LGu+VcJUysptGCXvSA/WZLd2LrRzztiVguwQc09Q=; b=XnxbtZIP9SkSEsgl/ckHpw1mbDkpCAbaBdzHz3ZSFlbx2gsgLrN1J1ZJTdFntFmCDD vFj4ZlVGFz/PLNXQLttws2gflfuvezcSTbVLLwKtoa6pbbEJ36wJza1ZQEugP4o7rrim MZ5TGnwldkEUDlkjbENXJ08ZpMRalXbMrm5OFzrPX8ZdV+L40u455YOff/d0OiZPybdZ Rg/hfYGJviGADJTzeQH9Pqo83jESrLoesmL3sMWkiOhXaVR7tH6o1Wgs+mgsTblxPa7x NAVmSz03XdKwT15NB02n2QBfRxTVhFp4VdhSAYthW375amQtjaaXYLWaD5K1j7eQrNa7 OzAA== 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:mime-version :content-transfer-encoding; bh=n42LGu+VcJUysptGCXvSA/WZLd2LrRzztiVguwQc09Q=; b=XFohWN6tM7L/nE+1RhZHw4gXinBEtsMtt3ligKuYKgm2Lu/WYV6+ZEa807wHJYbhiG 5kaAdWgCPI67skTDWCPe0garZryNEWRPGkDhnBVPWQc0yV/EmPt+jB+7fNA0PMW9yHwj ijFV4OpCnhBIR8ByQESqb0d/Dw3F06ukwTAAmjVEML20UvDGGVdSRcrOkURv3Xk52iqr VIr/EemDceLcR5AGXtzynM+pQXQliap3Y+H6/+7WEf+J03daCwFdnjcgFqp+6qd4faH/ VQ+s3qrTS1gTMsGIVimLpwSIu/oMmMB3cLW/zqNfSXBhrCFdLB6eyGyvZNZq3bmzkULy cdsw== X-Gm-Message-State: AOAM5326FH1uLkNOGLeXsASIK6pdurETA2WzEQgr3GYyJPviemvGJ/JB 4tF0cpsc2Prq9UUD4qK7dIM= X-Received: by 2002:a50:eb89:: with SMTP id y9mr3229136edr.172.1619516696345; Tue, 27 Apr 2021 02:44:56 -0700 (PDT) Received: from linux.local (host-79-52-107-152.retail.telecomitalia.it. [79.52.107.152]) by smtp.gmail.com with ESMTPSA id mf27sm7602704ejb.63.2021.04.27.02.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Apr 2021 02:44:55 -0700 (PDT) From: "Fabio M. De Francesco" To: outreachy-kernel@googlegroups.com, dri-devel@lists.freedesktop.org, shaoyunl , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Daniel Vetter , Evan Quan , Hawking Zhang , Felix Kuehling , Luben Tuikov , Aurabindo Pillai , amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: "Fabio M. De Francesco" , Matthew Wilcox Subject: [PATCH v4] drm/amd/amdgpu/amdgpu_drv.c: Replace drm_modeset_lock_all with drm_modeset_lock Date: Tue, 27 Apr 2021 11:44:49 +0200 Message-Id: <20210427094449.14730-1-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org drm_modeset_lock_all() is not needed here, so it is replaced with drm_modeset_lock(). The crtc list around which we are looping never changes, therefore the only lock we need is to protect access to crtc->state. Suggested-by: Daniel Vetter Suggested-by: Matthew Wilcox Signed-off-by: Fabio M. De Francesco Reviewed-by: Matthew Wilcox (Oracle) --- Changes from v3: CC'ed more (previously missing) maintainers. Changes from v2: Drop file name from the Subject. Cc'ed all maintainers. Changes from v1: Removed unnecessary braces around single statement block. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 80130c1c0c68..39204dbc168b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1595,17 +1595,15 @@ static int amdgpu_pmops_runtime_idle(struct device *dev) if (amdgpu_device_has_dc_support(adev)) { struct drm_crtc *crtc; - drm_modeset_lock_all(drm_dev); - drm_for_each_crtc(crtc, drm_dev) { - if (crtc->state->active) { + drm_modeset_lock(&crtc->mutex, NULL); + if (crtc->state->active) ret = -EBUSY; + drm_modeset_unlock(&crtc->mutex); + if (ret < 0) break; - } } - drm_modeset_unlock_all(drm_dev); - } else { struct drm_connector *list_connector; struct drm_connector_list_iter iter; -- 2.31.1