drm/shmobile: Convert to Linux IRQ interfaces
Subsystems (2)
Thomas Zimmermann
maintainerPATCH 1/1 drm/shmobile: Convert to Linux IRQ interfaces
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.
--- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/shmobile/shmob_drm_drv.c +3 -5
@@ -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 (platform_get_irq (pdev,0 ), ddev);drm_dev_put (ddev);return 0 ;
@@ -258,7 +256,7 @@ static int shmob_drm_probe(struct platform_device *pdev) goto err_modeset_cleanup; } - ret =drm_irq_install (ddev,platform_get_irq (pdev,0 )); + ret =request_irq (platform_get_irq (pdev,0 ), 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 +273,7 @@ static int shmob_drm_probe(struct platform_device *pdev)return 0 ; err_irq_uninstall: -drm_irq_uninstall (ddev); +free_irq (platform_get_irq (pdev,0 ), ddev); err_modeset_cleanup:drm_kms_helper_poll_fini (ddev); err_free_drm_dev:
Signature · 1 line
2.32.0
Hi Thomas,
Quoted 5 lines · 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.
Signed-off-by Thomas Zimmermann <[email protected]>
Looks fine,
Sam
Hi Thomas,
Thank you for the patch.
Quoted 39 lines · 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.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/gpu/drm/shmobile/shmob_drm_drv.c +1
-3@@ -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 (platform_get_irq (pdev,0 ), ddev);drm_dev_put (ddev);return 0 ;
drivers/gpu/drm/shmobile/shmob_drm_drv.c static int shmob_drm_probe(struct platform_device *pdev) · line 259
Quoted 5 lines
drivers/gpu/drm/shmobile/shmob_drm_drv.c +1
-1@@ -258,7 +256,7 @@ static int shmob_drm_probe(struct platform_device *pdev) goto err_modeset_cleanup; } - ret =drm_irq_install (ddev,platform_get_irq (pdev,0 )); + ret =request_irq (platform_get_irq (pdev,0 ), shmob_drm_irq,0 , ddev->driver->name, ddev);
Could you store the irq number in a local variable, and wrap this line at 80 columns ? You can then use the local variable in the free_irq() call below. With this addressed,
Quoted 12 lines
drivers/gpu/drm/shmobile/shmob_drm_drv.c +1
-1if (ret <0 ) {dev_err (&pdev->dev,"failed to install IRQ handler\n" ); goto err_modeset_cleanup;@@ -275,7 +273,7 @@ static int shmob_drm_probe(struct platform_device *pdev)return 0 ; err_irq_uninstall: -drm_irq_uninstall (ddev); +free_irq (platform_get_irq (pdev,0 ), ddev); err_modeset_cleanup:drm_kms_helper_poll_fini (ddev); err_free_drm_dev:
Signature · 3 lines
Regards, Laurent Pinchart
Hi Thomas,
Quoted 5 lines · 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.
Signed-off-by Thomas Zimmermann <[email protected]>
Thanks for your patch!
drivers/gpu/drm/shmobile/shmob_drm_drv.c static int shmob_drm_probe(struct platform_device *pdev) · line 259
Quoted 8 lines
drivers/gpu/drm/shmobile/shmob_drm_drv.c +1
-1@@ -258,7 +256,7 @@ static int shmob_drm_probe(struct platform_device *pdev) goto err_modeset_cleanup; } - ret =drm_irq_install (ddev,platform_get_irq (pdev,0 )); + ret =request_irq (platform_get_irq (pdev,0 ), shmob_drm_irq,0 , ddev->driver->name, ddev);
platform_get_irq() can return a negative error code.
While drm_irq_install() took a signed irq parameter (and only considered zero an error, oops), request_irq() takes an unsigned irq. So you better check for errors before calling request_irq().
drivers/gpu/drm/shmobile/shmob_drm_drv.c static int shmob_drm_probe(struct platform_device *pdev) · line 276
Quoted 9 lines
drivers/gpu/drm/shmobile/shmob_drm_drv.c +1
-1if (ret <0 ) {dev_err (&pdev->dev,"failed to install IRQ handler\n" ); goto err_modeset_cleanup;@@ -275,7 +273,7 @@ static int shmob_drm_probe(struct platform_device *pdev)return 0 ; err_irq_uninstall: -drm_irq_uninstall (ddev); +free_irq (platform_get_irq (pdev,0 ), ddev);
Similar issue here.
drivers/gpu/drm/shmobile/shmob_drm_drv.c static int shmob_drm_probe(struct platform_device *pdev) · line 279
Quoted 3 lines
drivers/gpu/drm/shmobile/shmob_drm_drv.c +0
-0err_modeset_cleanup:drm_kms_helper_poll_fini (ddev); err_free_drm_dev:
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 13 lines · 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.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/gpu/drm/shmobile/shmob_drm_drv.c +0
-0
[...]
drivers/gpu/drm/shmobile/shmob_drm_drv.c static int shmob_drm_probe(struct platform_device *pdev) · line 259
Quoted 6 lines
drivers/gpu/drm/shmobile/shmob_drm_drv.c +1
-1@@ -258,7 +256,7 @@ static int shmob_drm_probe(struct platform_device *pdev) goto err_modeset_cleanup; } - ret =drm_irq_install (ddev,platform_get_irq (pdev,0 )); + ret =request_irq (platform_get_irq (pdev,0 ), shmob_drm_irq,0 , ddev->driver->name, ddev);
You can't call request_irq() on the result of platfrom_get_irq(), you need to check ifq >= 0 first!
You really need a local (or even global) variable for the IRQ #...
[...]
MBR, Sergei