Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8984070ybi; Tue, 23 Jul 2019 19:27:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1MAvbLdaorbhCvF0TLZeUoMLQ5n0zzWKIEQ2ZmggauB51+mYHRGjkok56gc+5P0XufjJX X-Received: by 2002:a62:2f06:: with SMTP id v6mr8890138pfv.195.1563935276171; Tue, 23 Jul 2019 19:27:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563935276; cv=none; d=google.com; s=arc-20160816; b=jv7bIJ+ZJof7g1HyRbxE4cwbt1kw2C/Jz50zFcIpR/m/PBBF057TwjiAkHpbcxPOzV hKIpOXYMxEppXLmbuqdh5Iic23CWRxq0uBrZ9O4RmsQAP2I+xPUcX+++7uMrMcaa74MD jbhs8bz/H1g0p2nh9enb18GoFa2Rqmb9Ln/IJ/geU/NpdxZH4sNd5It7HjF3fKgDy4Qv qFY9tEi7qmwp8Rp+j5wyEvIdZFBVXGpt+ybZ2xBW700sqMp9zNiTQJqz1A9FxL+rv1KB UoNqIG6YGZAYfHFWSKl7vBXs9+gf/77cQPrkj9Q98JgwB2lb/gZFVPF7rxUlDdgnKXH+ U3GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LIXup0fVFWNf86/DVnHha31m2DWJ3Zw6X12AGN8eLZA=; b=SUkCDvAd2r9p0buGbilDX8nR5eF9tShS3JHp3dZrIdBpw8306ttPUOrMScUCxb6hUC OHHscRgUbDUwFz8ojogtYqC9rWuRvZWcssX2kNmRN5QdO5ZfTyGV3W0uyBZU+EUNXIVh v3vMNeKvAcUw01IOTsyIcRllnhxyNE3XZh800Ag4mPxtbVQWtYiuRdq3t0Svsfb+OfzK E/4igZuVQpc5ol0RFJiZ/0rG5p5ZLXjmdD+tIOTNdp1u8BsexJsRYLMJxS5+BifwWXk0 59b6ui+zupvNBbhfEtdTZlBeU17zg+aaMS1Kdt9ezwxUDpggeUvkNYzaxaPfPA8rZ7vK buCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oHdcACKP; 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=pass (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 j185si13477481pge.91.2019.07.23.19.27.40; Tue, 23 Jul 2019 19:27:56 -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=pass header.i=@gmail.com header.s=20161025 header.b=oHdcACKP; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403827AbfGWSsF (ORCPT + 99 others); Tue, 23 Jul 2019 14:48:05 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34662 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728243AbfGWSsF (ORCPT ); Tue, 23 Jul 2019 14:48:05 -0400 Received: by mail-wr1-f67.google.com with SMTP id 31so44313178wrm.1 for ; Tue, 23 Jul 2019 11:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LIXup0fVFWNf86/DVnHha31m2DWJ3Zw6X12AGN8eLZA=; b=oHdcACKPK/OVOvIbPpPDuS1Z9gmvTd1eQ0qLtJL6QJToRs78djHD1kV87A4mI4VdVI iVHKyScper77gwAvQatz4D0ofZBDWqK0cjPJPyt8oSc4uv1jpAKnY/lHROw6AunN6csn qdSdEWRgnwNRwlymecJhNTaiBoGRTUp2VbGPXRiml3PipaGvOhjWO+YIZ5GcTznU6baB qzhtinDaIGFYGgwwn5d95YeFQKaqVmvL7n8uZQAzXhh5cyz1ShYGATUewp/aBzR3CxMY aoXF7zXaLGyyQCPUT+JZYBzl1rDMwlHF2K5EVjAHc9p8F0YSlg0OCnfGW9f8oaU2e6Rz iihQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LIXup0fVFWNf86/DVnHha31m2DWJ3Zw6X12AGN8eLZA=; b=LuR1h4+jO4KKei5PDXA7fAnk62RpWLgVkMpRGNTyaeGh3HbuyNLP6pz2EfpbhFsGnW mJTGFLbOXvG1CEGESeqOQsMI+XznADPUUZ4c6bKWybfH3Au768soRrzEG3G0zhSW32me kUG78gEjDJZZIPwiwDxGrGoAQ7IMscGsk+I/m3QY8waUMPMb0mVeyUfzGLRzfN1v3C4g b8usGGSpdXLytc74utsSzS0yPuFZYG8WFZomeRAyj3z03xe29EXr21t03Fs7BksNQiXF k1XHpevCvK4fKWqQgEGdEOaveaps40mshvkjYgAq4IJAM5zctdAAg0SoNH+7AShSVbd/ 80ug== X-Gm-Message-State: APjAAAVPUZCxNhvFO1oB28JpcEGu9exrNbjaUQ56t1ZKQggnKe2Hnr7D hnKRnozZmf5eGikA1Yl7Hd9i32qIeGriLKR5DjQ= X-Received: by 2002:adf:a299:: with SMTP id s25mr75095757wra.74.1563907683302; Tue, 23 Jul 2019 11:48:03 -0700 (PDT) MIME-Version: 1.0 References: <20190723090449.27589-1-hslester96@gmail.com> In-Reply-To: <20190723090449.27589-1-hslester96@gmail.com> From: Alex Deucher Date: Tue, 23 Jul 2019 14:47:52 -0400 Message-ID: Subject: Re: [PATCH] drm/amdgpu: Use dev_get_drvdata where possible To: Chuhong Yuan Cc: David Zhou , David Airlie , LKML , amd-gfx list , Maling list - DRI developers , Daniel Vetter , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 23, 2019 at 9:36 AM Chuhong Yuan wrote: > > Instead of using to_pci_dev + pci_get_drvdata, > use dev_get_drvdata to make code simpler. > > Signed-off-by: Chuhong Yuan Applied. thanks! Alex > --- > 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 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx