#include <linux/platform_device.h>
-#include <drm/drm_drv.h>
#include <drm/drm_print.h>
#include "vc4_drv.h"
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)
{
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;
return;
vc4_irq_disable(dev);
- free_irq(vc4->irq, dev);
}
/** Reinitializes interrupt registers when a GPU reset is performed. */