linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] drm/shmobile: Convert to Linux IRQ interfaces
@ 2021-07-20  8:09 Thomas Zimmermann
  2021-07-22 14:29 ` Thomas Zimmermann
  2021-07-23  4:27 ` Laurent Pinchart
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Zimmermann @ 2021-07-20  8:09 UTC (permalink / raw)
  To: laurent.pinchart, kieran.bingham+renesas, airlied, daniel, sam,
	geert, sergei.shtylyov
  Cc: linux-renesas-soc, dri-devel, Thomas Zimmermann

Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's
IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers
don't benefit from using it.

v3:
	* return error if (ret < 0) (Geert)
	* remove duplicate error message (Geert)
v2:
	* handle errors in platform_get_irq() (Geert, Sergei)
	* store IRQ number in struct shmob_drm_device (Laurent)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/shmobile/shmob_drm_drv.c | 14 +++++++++-----
 drivers/gpu/drm/shmobile/shmob_drm_drv.h |  1 +
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index 0a02b7092c04..7db01904d18d 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -18,7 +18,6 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
 
@@ -130,7 +129,6 @@ DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops);
 
 static const struct drm_driver shmob_drm_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET,
-	.irq_handler		= shmob_drm_irq,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops			= &shmob_drm_fops,
 	.name			= "shmob-drm",
@@ -183,7 +181,7 @@ static int shmob_drm_remove(struct platform_device *pdev)
 
 	drm_dev_unregister(ddev);
 	drm_kms_helper_poll_fini(ddev);
-	drm_irq_uninstall(ddev);
+	free_irq(sdev->irq, ddev);
 	drm_dev_put(ddev);
 
 	return 0;
@@ -258,7 +256,13 @@ static int shmob_drm_probe(struct platform_device *pdev)
 		goto err_modeset_cleanup;
 	}
 
-	ret = drm_irq_install(ddev, platform_get_irq(pdev, 0));
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto err_modeset_cleanup;
+	sdev->irq = ret;
+
+	ret = request_irq(sdev->irq, shmob_drm_irq, 0, ddev->driver->name,
+			  ddev);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to install IRQ handler\n");
 		goto err_modeset_cleanup;
@@ -275,7 +279,7 @@ static int shmob_drm_probe(struct platform_device *pdev)
 	return 0;
 
 err_irq_uninstall:
-	drm_irq_uninstall(ddev);
+	free_irq(sdev->irq, ddev);
 err_modeset_cleanup:
 	drm_kms_helper_poll_fini(ddev);
 err_free_drm_dev:
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.h b/drivers/gpu/drm/shmobile/shmob_drm_drv.h
index 80dc4b1020aa..4964ddd5ab74 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.h
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.h
@@ -29,6 +29,7 @@ struct shmob_drm_device {
 	u32 lddckr;
 	u32 ldmt1r;
 
+	unsigned int irq;
 	spinlock_t irq_lock;		/* Protects hardware LDINTR register */
 
 	struct drm_device *ddev;
-- 
2.32.0


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

* Re: [PATCH v3] drm/shmobile: Convert to Linux IRQ interfaces
  2021-07-20  8:09 [PATCH v3] drm/shmobile: Convert to Linux IRQ interfaces Thomas Zimmermann
@ 2021-07-22 14:29 ` Thomas Zimmermann
  2021-07-23  4:27 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Zimmermann @ 2021-07-22 14:29 UTC (permalink / raw)
  To: laurent.pinchart, kieran.bingham+renesas, airlied, daniel, sam,
	geert, sergei.shtylyov
  Cc: linux-renesas-soc, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 3319 bytes --]

Hi, if there are no further comments on this patch, I'd like to merge it 
soon.

Am 20.07.21 um 10:09 schrieb Thomas Zimmermann:
> Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's
> IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers
> don't benefit from using it.
> 
> v3:
> 	* return error if (ret < 0) (Geert)
> 	* remove duplicate error message (Geert)
> v2:
> 	* handle errors in platform_get_irq() (Geert, Sergei)
> 	* store IRQ number in struct shmob_drm_device (Laurent)
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>   drivers/gpu/drm/shmobile/shmob_drm_drv.c | 14 +++++++++-----
>   drivers/gpu/drm/shmobile/shmob_drm_drv.h |  1 +
>   2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index 0a02b7092c04..7db01904d18d 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -18,7 +18,6 @@
>   #include <drm/drm_crtc_helper.h>
>   #include <drm/drm_drv.h>
>   #include <drm/drm_gem_cma_helper.h>
> -#include <drm/drm_irq.h>
>   #include <drm/drm_probe_helper.h>
>   #include <drm/drm_vblank.h>
>   
> @@ -130,7 +129,6 @@ DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops);
>   
>   static const struct drm_driver shmob_drm_driver = {
>   	.driver_features	= DRIVER_GEM | DRIVER_MODESET,
> -	.irq_handler		= shmob_drm_irq,
>   	DRM_GEM_CMA_DRIVER_OPS,
>   	.fops			= &shmob_drm_fops,
>   	.name			= "shmob-drm",
> @@ -183,7 +181,7 @@ static int shmob_drm_remove(struct platform_device *pdev)
>   
>   	drm_dev_unregister(ddev);
>   	drm_kms_helper_poll_fini(ddev);
> -	drm_irq_uninstall(ddev);
> +	free_irq(sdev->irq, ddev);
>   	drm_dev_put(ddev);
>   
>   	return 0;
> @@ -258,7 +256,13 @@ static int shmob_drm_probe(struct platform_device *pdev)
>   		goto err_modeset_cleanup;
>   	}
>   
> -	ret = drm_irq_install(ddev, platform_get_irq(pdev, 0));
> +	ret = platform_get_irq(pdev, 0);
> +	if (ret < 0)
> +		goto err_modeset_cleanup;
> +	sdev->irq = ret;
> +
> +	ret = request_irq(sdev->irq, shmob_drm_irq, 0, ddev->driver->name,
> +			  ddev);
>   	if (ret < 0) {
>   		dev_err(&pdev->dev, "failed to install IRQ handler\n");
>   		goto err_modeset_cleanup;
> @@ -275,7 +279,7 @@ static int shmob_drm_probe(struct platform_device *pdev)
>   	return 0;
>   
>   err_irq_uninstall:
> -	drm_irq_uninstall(ddev);
> +	free_irq(sdev->irq, ddev);
>   err_modeset_cleanup:
>   	drm_kms_helper_poll_fini(ddev);
>   err_free_drm_dev:
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.h b/drivers/gpu/drm/shmobile/shmob_drm_drv.h
> index 80dc4b1020aa..4964ddd5ab74 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.h
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.h
> @@ -29,6 +29,7 @@ struct shmob_drm_device {
>   	u32 lddckr;
>   	u32 ldmt1r;
>   
> +	unsigned int irq;
>   	spinlock_t irq_lock;		/* Protects hardware LDINTR register */
>   
>   	struct drm_device *ddev;
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH v3] drm/shmobile: Convert to Linux IRQ interfaces
  2021-07-20  8:09 [PATCH v3] drm/shmobile: Convert to Linux IRQ interfaces Thomas Zimmermann
  2021-07-22 14:29 ` Thomas Zimmermann
@ 2021-07-23  4:27 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2021-07-23  4:27 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: kieran.bingham+renesas, airlied, daniel, sam, geert,
	sergei.shtylyov, linux-renesas-soc, dri-devel

Hi Thomas,

Thank you for the patch.

On Tue, Jul 20, 2021 at 10:09:41AM +0200, Thomas Zimmermann wrote:
> Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's
> IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers
> don't benefit from using it.
> 
> v3:
> 	* return error if (ret < 0) (Geert)
> 	* remove duplicate error message (Geert)
> v2:
> 	* handle errors in platform_get_irq() (Geert, Sergei)
> 	* store IRQ number in struct shmob_drm_device (Laurent)
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c | 14 +++++++++-----
>  drivers/gpu/drm/shmobile/shmob_drm_drv.h |  1 +
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index 0a02b7092c04..7db01904d18d 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -18,7 +18,6 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_gem_cma_helper.h>
> -#include <drm/drm_irq.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_vblank.h>
>  
> @@ -130,7 +129,6 @@ DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops);
>  
>  static const struct drm_driver shmob_drm_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET,
> -	.irq_handler		= shmob_drm_irq,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops			= &shmob_drm_fops,
>  	.name			= "shmob-drm",
> @@ -183,7 +181,7 @@ static int shmob_drm_remove(struct platform_device *pdev)
>  
>  	drm_dev_unregister(ddev);
>  	drm_kms_helper_poll_fini(ddev);
> -	drm_irq_uninstall(ddev);
> +	free_irq(sdev->irq, ddev);
>  	drm_dev_put(ddev);
>  
>  	return 0;
> @@ -258,7 +256,13 @@ static int shmob_drm_probe(struct platform_device *pdev)
>  		goto err_modeset_cleanup;
>  	}
>  
> -	ret = drm_irq_install(ddev, platform_get_irq(pdev, 0));
> +	ret = platform_get_irq(pdev, 0);
> +	if (ret < 0)
> +		goto err_modeset_cleanup;
> +	sdev->irq = ret;
> +
> +	ret = request_irq(sdev->irq, shmob_drm_irq, 0, ddev->driver->name,
> +			  ddev);

We could pass sdev to this function instead of ddev (and same for
free_irq()), and update shmob_drm_irq() accordingly. This could however
be made on top, so

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed to install IRQ handler\n");
>  		goto err_modeset_cleanup;
> @@ -275,7 +279,7 @@ static int shmob_drm_probe(struct platform_device *pdev)
>  	return 0;
>  
>  err_irq_uninstall:
> -	drm_irq_uninstall(ddev);
> +	free_irq(sdev->irq, ddev);
>  err_modeset_cleanup:
>  	drm_kms_helper_poll_fini(ddev);
>  err_free_drm_dev:
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.h b/drivers/gpu/drm/shmobile/shmob_drm_drv.h
> index 80dc4b1020aa..4964ddd5ab74 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.h
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.h
> @@ -29,6 +29,7 @@ struct shmob_drm_device {
>  	u32 lddckr;
>  	u32 ldmt1r;
>  
> +	unsigned int irq;
>  	spinlock_t irq_lock;		/* Protects hardware LDINTR register */
>  
>  	struct drm_device *ddev;
> 

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2021-07-23  4:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20  8:09 [PATCH v3] drm/shmobile: Convert to Linux IRQ interfaces Thomas Zimmermann
2021-07-22 14:29 ` Thomas Zimmermann
2021-07-23  4:27 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox