[v2,2/2] drm/drv: drm_dev_unplug(): Move out drm_dev_put() call

Submitted by Noralf Trønnes on Feb. 8, 2019, 2:01 p.m.

Details

Message ID 20190208140103.28919-3-noralf@tronnes.org
State New
Series "drm/drv: Rework drm_dev_unplug() (was: Remove drm_dev_unplug())"
Headers show

Commit Message

Noralf Trønnes Feb. 8, 2019, 2:01 p.m.
This makes it possible to use drm_dev_unplug() with the upcoming
devm_drm_dev_init() which will do drm_dev_put() in its release callback.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---

I will take this through drm-misc-next.

Noralf.

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
 drivers/gpu/drm/drm_drv.c               | 1 -
 drivers/gpu/drm/udl/udl_drv.c           | 1 +
 drivers/gpu/drm/xen/xen_drm_front.c     | 1 +
 4 files changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index a1bb3773087b..d1f37ba3c118 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -971,6 +971,7 @@  amdgpu_pci_remove(struct pci_dev *pdev)
 
 	DRM_ERROR("Device removal is currently not supported outside of fbcon\n");
 	drm_dev_unplug(dev);
+	drm_dev_put(dev);
 	pci_disable_device(pdev);
 	pci_set_drvdata(pdev, NULL);
 }
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 05bbc2b622fc..b04982101fcb 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -376,7 +376,6 @@  void drm_dev_unplug(struct drm_device *dev)
 	synchronize_srcu(&drm_unplug_srcu);
 
 	drm_dev_unregister(dev);
-	drm_dev_put(dev);
 }
 EXPORT_SYMBOL(drm_dev_unplug);
 
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index 22cd2d13e272..53b7b8c04bc6 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -107,6 +107,7 @@  static void udl_usb_disconnect(struct usb_interface *interface)
 	udl_fbdev_unplug(dev);
 	udl_drop_usb(dev);
 	drm_dev_unplug(dev);
+	drm_dev_put(dev);
 }
 
 /*
diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
index 3e78a832d7f9..84aa4d61dc42 100644
--- a/drivers/gpu/drm/xen/xen_drm_front.c
+++ b/drivers/gpu/drm/xen/xen_drm_front.c
@@ -582,6 +582,7 @@  static void xen_drm_drv_fini(struct xen_drm_front_info *front_info)
 
 	drm_kms_helper_poll_fini(dev);
 	drm_dev_unplug(dev);
+	drm_dev_put(dev);
 
 	front_info->drm_info = NULL;
 

Comments

Oleksandr Andrushchenko Feb. 8, 2019, 2:36 p.m.
On 2/8/19 4:01 PM, Noralf Trønnes wrote:
> This makes it possible to use drm_dev_unplug() with the upcoming
> devm_drm_dev_init() which will do drm_dev_put() in its release callback.
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>
> I will take this through drm-misc-next.
>
> Noralf.
>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
>   drivers/gpu/drm/drm_drv.c               | 1 -
>   drivers/gpu/drm/udl/udl_drv.c           | 1 +
>   drivers/gpu/drm/xen/xen_drm_front.c     | 1 +
>   4 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index a1bb3773087b..d1f37ba3c118 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -971,6 +971,7 @@ amdgpu_pci_remove(struct pci_dev *pdev)
>   
>   	DRM_ERROR("Device removal is currently not supported outside of fbcon\n");
>   	drm_dev_unplug(dev);
> +	drm_dev_put(dev);
>   	pci_disable_device(pdev);
>   	pci_set_drvdata(pdev, NULL);
>   }
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 05bbc2b622fc..b04982101fcb 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -376,7 +376,6 @@ void drm_dev_unplug(struct drm_device *dev)
>   	synchronize_srcu(&drm_unplug_srcu);
>   
>   	drm_dev_unregister(dev);
> -	drm_dev_put(dev);
>   }
>   EXPORT_SYMBOL(drm_dev_unplug);
>   
> diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> index 22cd2d13e272..53b7b8c04bc6 100644
> --- a/drivers/gpu/drm/udl/udl_drv.c
> +++ b/drivers/gpu/drm/udl/udl_drv.c
> @@ -107,6 +107,7 @@ static void udl_usb_disconnect(struct usb_interface *interface)
>   	udl_fbdev_unplug(dev);
>   	udl_drop_usb(dev);
>   	drm_dev_unplug(dev);
> +	drm_dev_put(dev);
>   }
>   
>   /*
> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
> index 3e78a832d7f9..84aa4d61dc42 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
> @@ -582,6 +582,7 @@ static void xen_drm_drv_fini(struct xen_drm_front_info *front_info)
>   
>   	drm_kms_helper_poll_fini(dev);
>   	drm_dev_unplug(dev);
> +	drm_dev_put(dev);
>   
Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>   	front_info->drm_info = NULL;
>
Daniel Vetter Feb. 11, 2019, 8:28 a.m.
On Fri, Feb 08, 2019 at 03:01:03PM +0100, Noralf Trønnes wrote:
> This makes it possible to use drm_dev_unplug() with the upcoming
> devm_drm_dev_init() which will do drm_dev_put() in its release callback.
> 
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
> 
> I will take this through drm-misc-next.
> 
> Noralf.
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
>  drivers/gpu/drm/drm_drv.c               | 1 -
>  drivers/gpu/drm/udl/udl_drv.c           | 1 +
>  drivers/gpu/drm/xen/xen_drm_front.c     | 1 +
>  4 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index a1bb3773087b..d1f37ba3c118 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -971,6 +971,7 @@ amdgpu_pci_remove(struct pci_dev *pdev)
>  
>  	DRM_ERROR("Device removal is currently not supported outside of fbcon\n");
>  	drm_dev_unplug(dev);
> +	drm_dev_put(dev);
>  	pci_disable_device(pdev);
>  	pci_set_drvdata(pdev, NULL);
>  }
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 05bbc2b622fc..b04982101fcb 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -376,7 +376,6 @@ void drm_dev_unplug(struct drm_device *dev)
>  	synchronize_srcu(&drm_unplug_srcu);
>  
>  	drm_dev_unregister(dev);
> -	drm_dev_put(dev);
>  }
>  EXPORT_SYMBOL(drm_dev_unplug);
>  
> diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> index 22cd2d13e272..53b7b8c04bc6 100644
> --- a/drivers/gpu/drm/udl/udl_drv.c
> +++ b/drivers/gpu/drm/udl/udl_drv.c
> @@ -107,6 +107,7 @@ static void udl_usb_disconnect(struct usb_interface *interface)
>  	udl_fbdev_unplug(dev);
>  	udl_drop_usb(dev);
>  	drm_dev_unplug(dev);
> +	drm_dev_put(dev);
>  }
>  
>  /*
> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
> index 3e78a832d7f9..84aa4d61dc42 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
> @@ -582,6 +582,7 @@ static void xen_drm_drv_fini(struct xen_drm_front_info *front_info)
>  
>  	drm_kms_helper_poll_fini(dev);
>  	drm_dev_unplug(dev);
> +	drm_dev_put(dev);
>  
>  	front_info->drm_info = NULL;
>  
> -- 
> 2.20.1
>