From: Maíra Canal Date: Mon, 30 Mar 2026 17:51:47 +0000 (-0300) Subject: drm/vc4: Use devm_request_irq() for automatic cleanup X-Git-Tag: v7.2-rc1~141^2~26^2~173 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=19e2815babd4c51a51ebabfe68daa90eb26309c3;p=thirdparty%2Flinux.git drm/vc4: Use devm_request_irq() for automatic cleanup Switch from request_irq()/free_irq() to the device-managed alternative devm_request_irq(), letting device-managed resource cleanup handle IRQ teardown automatically. While here, inline vc4_irq_prepare() into vc4_irq_install() since it's the only caller. Reviewed-by: Melissa Wen Link: https://patch.msgid.link/20260330-vc4-misc-fixes-v1-5-92defc940a29@igalia.com Signed-off-by: Maíra Canal --- diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c index 63e88f90eef7c..8e5141bb50759 100644 --- a/drivers/gpu/drm/vc4/vc4_irq.c +++ b/drivers/gpu/drm/vc4/vc4_irq.c @@ -47,7 +47,6 @@ #include -#include #include #include "vc4_drv.h" @@ -242,23 +241,6 @@ vc4_irq(int irq, void *arg) return status; } -static void -vc4_irq_prepare(struct drm_device *dev) -{ - struct vc4_dev *vc4 = to_vc4_dev(dev); - - if (!vc4->v3d) - return; - - init_waitqueue_head(&vc4->job_wait_queue); - INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work); - - /* Clear any pending interrupts someone might have left around - * for us. - */ - V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); -} - void vc4_irq_enable(struct drm_device *dev) { @@ -307,12 +289,22 @@ int vc4_irq_install(struct drm_device *dev, int irq) if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) return -ENODEV; + if (!vc4->v3d) + return -ENODEV; + if (irq == IRQ_NOTCONNECTED) return -ENOTCONN; - vc4_irq_prepare(dev); + init_waitqueue_head(&vc4->job_wait_queue); + INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work); + + /* Clear any pending interrupts someone might have left around + * for us. + */ + V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); - ret = request_irq(irq, vc4_irq, 0, dev->driver->name, dev); + ret = devm_request_irq(dev->dev, irq, vc4_irq, 0, + dev_name(dev->dev), dev); if (ret) return ret; @@ -329,7 +321,6 @@ void vc4_irq_uninstall(struct drm_device *dev) return; vc4_irq_disable(dev); - free_irq(vc4->irq, dev); } /** Reinitializes interrupt registers when a GPU reset is performed. */