Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8575091ybi; Tue, 23 Jul 2019 11:02:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCK9K+yYLCcBMmI2jJSwhFUtLuEOv/1eZpDp1pa7sr2R2zX2BpFHd2YMM+PstzX9VQl9zo X-Received: by 2002:a63:2744:: with SMTP id n65mr64504135pgn.277.1563904955702; Tue, 23 Jul 2019 11:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563904955; cv=none; d=google.com; s=arc-20160816; b=ROZgk2bLHBICrTv7IJh/5v+t73dr3TZNojXORuCeWQCvzbcuv/VYz8KAEpBeExxSfZ Kw0N1WEFw9xVlu4T9RKFcSVOPH8OGZKp3MrrRqdu2wL+qBcU24aZRW9Zz+32bXPn5mei mvA0NH7CZErgw3HDtkBx5vP+M9bMF2a0uTi+dnQes+4S81UbeOiOV8UhnAx+6q4PYZBI dr8qYJETkwLmAea1zKnBcHp3ubWLYh67LSeXhQY1GITk9Vi7BWZFi0S8ek5EpHTQojFE 7YYdcIe/J18EkT+qbdBB73rGWW0FTZwUq/Fr1l2mieT2aK1fbttnnVsIXhZ4kq+DO5TG y8hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=q0Po2t8vMBWo5yX2pfDsLkHP1u5XK6Mx9PkT5fdjYG8=; b=Y5vSlfaXPCe6iS0bOgs1MA4mwCeF0xRZUTLrZ0BV69oOc3c4roFG6GlLOXlr+FGQS6 Bir7Wq9t9s+suUkK3bbualnqlPa/2aRHe0gKlzEeqW4fUid4YzWbCAlYqPW7P23ljRv3 Dukm82XjKOVNONJe1SYOwdcp8go+uLu+x3cPamr5FIe11d2NxbpmYfh/sy3r9R+pm4Dr jSWobl/yst6O8YCREHF7LKF9Fd9QxrlFvMJQ+2XyJHnzlZVZZ6v0QWvDSHhY9YIwhBrR KCrl07EbDe7ZjOHKRX9vQKto2pkeyprpMxAFNuxoanFLUINcPBIa0WwtG1sE/eY9blEy 23XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=GM2uf2W7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z17si13136296pgl.560.2019.07.23.11.02.19; Tue, 23 Jul 2019 11:02:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=GM2uf2W7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388769AbfGWJFM (ORCPT + 99 others); Tue, 23 Jul 2019 05:05:12 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40908 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbfGWJFM (ORCPT ); Tue, 23 Jul 2019 05:05:12 -0400 Received: by mail-pg1-f195.google.com with SMTP id w10so19104761pgj.7 for ; Tue, 23 Jul 2019 02:05:12 -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=q0Po2t8vMBWo5yX2pfDsLkHP1u5XK6Mx9PkT5fdjYG8=; b=GM2uf2W7Igd9e55i5i0eZpV6eTP1FWB9O+BRMOE0iuMwen2uXvQUaOHmQLSn8Sqa1f YZtRbIoKEIHQN0n8QZ1Q2gjDf2+82vkQkxZcYj7ZQJ3nW2llVA9dDQ/8U+5pS9tfhjq/ nI24gEItIF+najDQu2Z5a1Jm/O7JcBA10Q+6XCcgVuCawTajiDg5d1Yr5POBhgqWa/4l 5U7ngGWsjI2gaf5+czBFW8b+8Y0+kh8vRdJgNGWykRJNm42fbmx2tyxft1BG/xME6a1c jiDfFyC9YTsz4jP9frqZa9fSwrZH+m4iCyi6OmmCANTA3/S0bceQlWhX8ZtO4afBKVj3 PGuw== 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=q0Po2t8vMBWo5yX2pfDsLkHP1u5XK6Mx9PkT5fdjYG8=; b=WK5yfUg/+BZzVguVC/w7/+KR98lGmvDZASTeSKCxVrUrmutAhkjlRzjRbU8TYAyw7R bd2sq2zjlCxn0SoWSDijHIPlWCODMQH5JZwVeJCitp3zcEndv0e3NnfgxRTwdNyryndm Pfa9tstt+MORPD+bo4UGCoob1N0rtm5tM/9IHFQ20Yao8aBlLGh6Iovnt9wUceIJhPGT /yMFS7scmNM768CjLpomWEC/lRw03YWM1rZPOegVGtNCbo0U7/s4rk2KlLL8uZB6V2bq 4IVPpUwDl/QPxdUbIUAR2I1rlw3wN89V+aFU1Km8jv6NiOcviWg5VvGY11Qw4Jf0vDCZ hAIA== X-Gm-Message-State: APjAAAU3KZzPvcQZ4NgPT4jb6S0spoZLF/9dYMyzlYlLqfjzeKyDzWCs dh90tYwt1wqFk6Yq2tpHH7U= X-Received: by 2002:a17:90a:1b48:: with SMTP id q66mr77930931pjq.83.1563872711763; Tue, 23 Jul 2019 02:05:11 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id d23sm33574749pjv.18.2019.07.23.02.05.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 02:05:11 -0700 (PDT) From: Chuhong Yuan Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Zhou , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH] drm/amdgpu: Use dev_get_drvdata where possible Date: Tue, 23 Jul 2019 17:04:50 +0800 Message-Id: <20190723090449.27589-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of using to_pci_dev + pci_get_drvdata, use dev_get_drvdata to make code simpler. Signed-off-by: Chuhong Yuan --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 27 +++++++++---------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index f2e8b4238efd..df82091a29d3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1097,16 +1097,14 @@ amdgpu_pci_shutdown(struct pci_dev *pdev) static int amdgpu_pmops_suspend(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); + struct drm_device *drm_dev = dev_get_drvdata(dev); - struct drm_device *drm_dev = pci_get_drvdata(pdev); return amdgpu_device_suspend(drm_dev, true, true); } static int amdgpu_pmops_resume(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct drm_device *drm_dev = dev_get_drvdata(dev); /* GPU comes up enabled by the bios on resume */ if (amdgpu_device_is_px(drm_dev)) { @@ -1120,33 +1118,29 @@ static int amdgpu_pmops_resume(struct device *dev) static int amdgpu_pmops_freeze(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - - struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct drm_device *drm_dev = dev_get_drvdata(dev); + return amdgpu_device_suspend(drm_dev, false, true); } static int amdgpu_pmops_thaw(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - - struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct drm_device *drm_dev = dev_get_drvdata(dev); + return amdgpu_device_resume(drm_dev, false, true); } static int amdgpu_pmops_poweroff(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - - struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct drm_device *drm_dev = dev_get_drvdata(dev); + return amdgpu_device_suspend(drm_dev, true, true); } static int amdgpu_pmops_restore(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); + struct drm_device *drm_dev = dev_get_drvdata(dev); - struct drm_device *drm_dev = pci_get_drvdata(pdev); return amdgpu_device_resume(drm_dev, false, true); } @@ -1205,8 +1199,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) static int amdgpu_pmops_runtime_idle(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *drm_dev = pci_get_drvdata(pdev); + struct drm_device *drm_dev = dev_get_drvdata(dev); struct drm_crtc *crtc; if (!amdgpu_device_is_px(drm_dev)) { -- 2.20.1