All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/ast: Remove load/unload callbacks
@ 2019-11-13 15:58 Thomas Zimmermann
  2019-11-13 15:58 ` [PATCH 1/2] drm/ast: Replace drm_get_pci_device() and drm_put_dev() Thomas Zimmermann
  2019-11-13 15:58 ` [PATCH 2/2] drm/ast: Call struct drm_driver.{load, unload} before registering device Thomas Zimmermann
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2019-11-13 15:58 UTC (permalink / raw)
  To: airlied, daniel, kraxel, sam; +Cc: Thomas Zimmermann, dri-devel

This patchset removes the load/unload callback functions from ast. Tested
on AST 2100 HW.

Thomas Zimmermann (2):
  drm/ast: Replace drm_get_pci_device() and drm_put_dev()
  drm/ast: Call struct drm_driver.{load,unload} before registering
    device

 drivers/gpu/drm/ast/ast_drv.c | 42 ++++++++++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 5 deletions(-)

--
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] drm/ast: Replace drm_get_pci_device() and drm_put_dev()
  2019-11-13 15:58 [PATCH 0/2] drm/ast: Remove load/unload callbacks Thomas Zimmermann
@ 2019-11-13 15:58 ` Thomas Zimmermann
  2019-11-13 16:35   ` Daniel Vetter
  2019-11-13 15:58 ` [PATCH 2/2] drm/ast: Call struct drm_driver.{load, unload} before registering device Thomas Zimmermann
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Zimmermann @ 2019-11-13 15:58 UTC (permalink / raw)
  To: airlied, daniel, kraxel, sam; +Cc: Thomas Zimmermann, dri-devel

Both functions are deprecated. Open-code them them in preparation
of removing struct drm_driver.{load,unload}.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/ast/ast_drv.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index d763da6f0834..78c90a3c903b 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -86,9 +86,35 @@ static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
 
 static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
+	struct drm_device *dev;
+	int ret;
+
 	ast_kick_out_firmware_fb(pdev);
 
-	return drm_get_pci_dev(pdev, ent, &driver);
+	ret = pci_enable_device(pdev);
+	if (ret)
+		return ret;
+
+	dev = drm_dev_alloc(&driver, &pdev->dev);
+	if (IS_ERR(dev)) {
+		ret = PTR_ERR(dev);
+		goto err_pci_disable_device;
+	}
+
+	dev->pdev = pdev;
+	pci_set_drvdata(pdev, dev);
+
+	ret = drm_dev_register(dev, ent->driver_data);
+	if (ret)
+		goto err_drm_dev_put;
+
+	return 0;
+
+err_drm_dev_put:
+	drm_dev_put(dev);
+err_pci_disable_device:
+	pci_disable_device(pdev);
+	return ret;
 }
 
 static void
@@ -96,7 +122,8 @@ ast_pci_remove(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
-	drm_put_dev(dev);
+	drm_dev_unregister(dev);
+	drm_dev_put(dev);
 }
 
 static int ast_drm_freeze(struct drm_device *dev)
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] drm/ast: Call struct drm_driver.{load, unload} before registering device
  2019-11-13 15:58 [PATCH 0/2] drm/ast: Remove load/unload callbacks Thomas Zimmermann
  2019-11-13 15:58 ` [PATCH 1/2] drm/ast: Replace drm_get_pci_device() and drm_put_dev() Thomas Zimmermann
@ 2019-11-13 15:58 ` Thomas Zimmermann
  2019-11-13 16:42   ` Daniel Vetter
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Zimmermann @ 2019-11-13 15:58 UTC (permalink / raw)
  To: airlied, daniel, kraxel, sam; +Cc: Thomas Zimmermann, dri-devel

Both callbacks are deprecated. Remove them and call functions explicitly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/ast/ast_drv.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index 78c90a3c903b..9da26750a22d 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -104,17 +104,24 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	dev->pdev = pdev;
 	pci_set_drvdata(pdev, dev);
 
-	ret = drm_dev_register(dev, ent->driver_data);
+	ret = ast_driver_load(dev, ent->driver_data);
 	if (ret)
 		goto err_drm_dev_put;
 
+	ret = drm_dev_register(dev, ent->driver_data);
+	if (ret)
+		goto err_ast_driver_unload;
+
 	return 0;
 
+err_ast_driver_unload:
+	ast_driver_unload(dev);
 err_drm_dev_put:
 	drm_dev_put(dev);
 err_pci_disable_device:
 	pci_disable_device(pdev);
 	return ret;
+
 }
 
 static void
@@ -123,6 +130,7 @@ ast_pci_remove(struct pci_dev *pdev)
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
 	drm_dev_unregister(dev);
+	ast_driver_unload(dev);
 	drm_dev_put(dev);
 }
 
@@ -228,9 +236,6 @@ static struct drm_driver driver = {
 			   DRIVER_GEM |
 			   DRIVER_MODESET,
 
-	.load = ast_driver_load,
-	.unload = ast_driver_unload,
-
 	.fops = &ast_fops,
 	.name = DRIVER_NAME,
 	.desc = DRIVER_DESC,
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] drm/ast: Replace drm_get_pci_device() and drm_put_dev()
  2019-11-13 15:58 ` [PATCH 1/2] drm/ast: Replace drm_get_pci_device() and drm_put_dev() Thomas Zimmermann
@ 2019-11-13 16:35   ` Daniel Vetter
  2019-11-13 16:37     ` Daniel Vetter
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Vetter @ 2019-11-13 16:35 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: airlied, dri-devel, sam, kraxel

On Wed, Nov 13, 2019 at 04:58:56PM +0100, Thomas Zimmermann wrote:
> Both functions are deprecated. Open-code them them in preparation
> of removing struct drm_driver.{load,unload}.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/ast/ast_drv.c | 31 +++++++++++++++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index d763da6f0834..78c90a3c903b 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -86,9 +86,35 @@ static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
>  
>  static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  {
> +	struct drm_device *dev;
> +	int ret;
> +
>  	ast_kick_out_firmware_fb(pdev);
>  
> -	return drm_get_pci_dev(pdev, ent, &driver);
> +	ret = pci_enable_device(pdev);
> +	if (ret)
> +		return ret;
> +
> +	dev = drm_dev_alloc(&driver, &pdev->dev);

Would be nice to also switch over to embedding drm_device and
drm_dev_init, but for another patch. This is

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

> +	if (IS_ERR(dev)) {
> +		ret = PTR_ERR(dev);
> +		goto err_pci_disable_device;
> +	}
> +
> +	dev->pdev = pdev;
> +	pci_set_drvdata(pdev, dev);
> +
> +	ret = drm_dev_register(dev, ent->driver_data);
> +	if (ret)
> +		goto err_drm_dev_put;
> +
> +	return 0;
> +
> +err_drm_dev_put:
> +	drm_dev_put(dev);
> +err_pci_disable_device:
> +	pci_disable_device(pdev);
> +	return ret;
>  }
>  
>  static void
> @@ -96,7 +122,8 @@ ast_pci_remove(struct pci_dev *pdev)
>  {
>  	struct drm_device *dev = pci_get_drvdata(pdev);
>  
> -	drm_put_dev(dev);
> +	drm_dev_unregister(dev);
> +	drm_dev_put(dev);
>  }
>  
>  static int ast_drm_freeze(struct drm_device *dev)
> -- 
> 2.23.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] drm/ast: Replace drm_get_pci_device() and drm_put_dev()
  2019-11-13 16:35   ` Daniel Vetter
@ 2019-11-13 16:37     ` Daniel Vetter
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2019-11-13 16:37 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: airlied, dri-devel, sam, kraxel

On Wed, Nov 13, 2019 at 05:35:41PM +0100, Daniel Vetter wrote:
> On Wed, Nov 13, 2019 at 04:58:56PM +0100, Thomas Zimmermann wrote:
> > Both functions are deprecated. Open-code them them in preparation
> > of removing struct drm_driver.{load,unload}.
> > 
> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > ---
> >  drivers/gpu/drm/ast/ast_drv.c | 31 +++++++++++++++++++++++++++++--
> >  1 file changed, 29 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> > index d763da6f0834..78c90a3c903b 100644
> > --- a/drivers/gpu/drm/ast/ast_drv.c
> > +++ b/drivers/gpu/drm/ast/ast_drv.c
> > @@ -86,9 +86,35 @@ static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
> >  
> >  static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> >  {
> > +	struct drm_device *dev;
> > +	int ret;
> > +
> >  	ast_kick_out_firmware_fb(pdev);
> >  
> > -	return drm_get_pci_dev(pdev, ent, &driver);
> > +	ret = pci_enable_device(pdev);
> > +	if (ret)
> > +		return ret;
> > +
> > +	dev = drm_dev_alloc(&driver, &pdev->dev);
> 
> Would be nice to also switch over to embedding drm_device and
> drm_dev_init, but for another patch. This is

Even better: devm_drm_dev_init, and dropping the drm_dev_put/kfree at the
bottom of the pci_remove function.
-Daniel

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> > +	if (IS_ERR(dev)) {
> > +		ret = PTR_ERR(dev);
> > +		goto err_pci_disable_device;
> > +	}
> > +
> > +	dev->pdev = pdev;
> > +	pci_set_drvdata(pdev, dev);
> > +
> > +	ret = drm_dev_register(dev, ent->driver_data);
> > +	if (ret)
> > +		goto err_drm_dev_put;
> > +
> > +	return 0;
> > +
> > +err_drm_dev_put:
> > +	drm_dev_put(dev);
> > +err_pci_disable_device:
> > +	pci_disable_device(pdev);
> > +	return ret;
> >  }
> >  
> >  static void
> > @@ -96,7 +122,8 @@ ast_pci_remove(struct pci_dev *pdev)
> >  {
> >  	struct drm_device *dev = pci_get_drvdata(pdev);
> >  
> > -	drm_put_dev(dev);
> > +	drm_dev_unregister(dev);
> > +	drm_dev_put(dev);
> >  }
> >  
> >  static int ast_drm_freeze(struct drm_device *dev)
> > -- 
> > 2.23.0
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/ast: Call struct drm_driver.{load, unload} before registering device
  2019-11-13 15:58 ` [PATCH 2/2] drm/ast: Call struct drm_driver.{load, unload} before registering device Thomas Zimmermann
@ 2019-11-13 16:42   ` Daniel Vetter
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2019-11-13 16:42 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: airlied, dri-devel, sam, kraxel

On Wed, Nov 13, 2019 at 04:58:57PM +0100, Thomas Zimmermann wrote:
> Both callbacks are deprecated. Remove them and call functions explicitly.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

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

> ---
>  drivers/gpu/drm/ast/ast_drv.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index 78c90a3c903b..9da26750a22d 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -104,17 +104,24 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	dev->pdev = pdev;
>  	pci_set_drvdata(pdev, dev);
>  
> -	ret = drm_dev_register(dev, ent->driver_data);
> +	ret = ast_driver_load(dev, ent->driver_data);
>  	if (ret)
>  		goto err_drm_dev_put;
>  
> +	ret = drm_dev_register(dev, ent->driver_data);
> +	if (ret)
> +		goto err_ast_driver_unload;
> +
>  	return 0;
>  
> +err_ast_driver_unload:
> +	ast_driver_unload(dev);
>  err_drm_dev_put:
>  	drm_dev_put(dev);
>  err_pci_disable_device:
>  	pci_disable_device(pdev);
>  	return ret;
> +
>  }
>  
>  static void
> @@ -123,6 +130,7 @@ ast_pci_remove(struct pci_dev *pdev)
>  	struct drm_device *dev = pci_get_drvdata(pdev);
>  
>  	drm_dev_unregister(dev);
> +	ast_driver_unload(dev);
>  	drm_dev_put(dev);
>  }
>  
> @@ -228,9 +236,6 @@ static struct drm_driver driver = {
>  			   DRIVER_GEM |
>  			   DRIVER_MODESET,
>  
> -	.load = ast_driver_load,
> -	.unload = ast_driver_unload,
> -
>  	.fops = &ast_fops,
>  	.name = DRIVER_NAME,
>  	.desc = DRIVER_DESC,
> -- 
> 2.23.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-13 16:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 15:58 [PATCH 0/2] drm/ast: Remove load/unload callbacks Thomas Zimmermann
2019-11-13 15:58 ` [PATCH 1/2] drm/ast: Replace drm_get_pci_device() and drm_put_dev() Thomas Zimmermann
2019-11-13 16:35   ` Daniel Vetter
2019-11-13 16:37     ` Daniel Vetter
2019-11-13 15:58 ` [PATCH 2/2] drm/ast: Call struct drm_driver.{load, unload} before registering device Thomas Zimmermann
2019-11-13 16:42   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.