2019-07-23 21:26:24

by Chuhong Yuan

[permalink] [raw]
Subject: [PATCH] drm/radeon: Use dev_get_drvdata where possible

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <[email protected]>
---
drivers/gpu/drm/radeon/radeon_drv.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index a6cbe11f79c6..b2bb74d5bffb 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -358,15 +358,13 @@ radeon_pci_shutdown(struct pci_dev *pdev)

static int radeon_pmops_suspend(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 radeon_suspend_kms(drm_dev, true, true, false);
}

static int radeon_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 (radeon_is_px(drm_dev)) {
@@ -380,15 +378,13 @@ static int radeon_pmops_resume(struct device *dev)

static int radeon_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 radeon_suspend_kms(drm_dev, false, true, true);
}

static int radeon_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 radeon_resume_kms(drm_dev, false, true);
}

@@ -447,8 +443,7 @@ static int radeon_pmops_runtime_resume(struct device *dev)

static int radeon_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 (!radeon_is_px(drm_dev)) {
--
2.20.1


2019-07-24 02:26:58

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] drm/radeon: Use dev_get_drvdata where possible

On Tue, Jul 23, 2019 at 9:36 AM Chuhong Yuan <[email protected]> wrote:
>
> Instead of using to_pci_dev + pci_get_drvdata,
> use dev_get_drvdata to make code simpler.
>
> Signed-off-by: Chuhong Yuan <[email protected]>

Applied. thanks!

Alex

> ---
> drivers/gpu/drm/radeon/radeon_drv.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index a6cbe11f79c6..b2bb74d5bffb 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -358,15 +358,13 @@ radeon_pci_shutdown(struct pci_dev *pdev)
>
> static int radeon_pmops_suspend(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 radeon_suspend_kms(drm_dev, true, true, false);
> }
>
> static int radeon_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 (radeon_is_px(drm_dev)) {
> @@ -380,15 +378,13 @@ static int radeon_pmops_resume(struct device *dev)
>
> static int radeon_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 radeon_suspend_kms(drm_dev, false, true, true);
> }
>
> static int radeon_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 radeon_resume_kms(drm_dev, false, true);
> }
>
> @@ -447,8 +443,7 @@ static int radeon_pmops_runtime_resume(struct device *dev)
>
> static int radeon_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 (!radeon_is_px(drm_dev)) {
> --
> 2.20.1
>
> _______________________________________________
> amd-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx