[PATCH 09/11] drm/imx: page flip fixes
Rob Clark
rob.clark at linaro.org
Mon Oct 8 12:50:47 PDT 2012
From: Rob Clark <rob at ti.com>
The 'event' could be null, so don't list_del(&event->base.link).. and
in fact even if it wasn't null there is no reason to do this.
Also, this looks racy with the irq handler, so throw in a spinlock for
good measure.
Signed-off-by: Rob Clark <rob at ti.com>
---
drivers/staging/imx-drm/ipuv3-crtc.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
index 8fa0f4d..6745766 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -135,23 +135,26 @@ static int ipu_page_flip(struct drm_crtc *crtc,
struct drm_pending_vblank_event *event)
{
struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
+ struct drm_device *drm = ipu_crtc->base.dev;
+ unsigned long flags;
int ret;
if (ipu_crtc->newfb)
return -EBUSY;
+ spin_lock_irqsave(&drm->event_lock, flags);
ret = imx_drm_crtc_vblank_get(ipu_crtc->imx_crtc);
if (ret) {
dev_dbg(ipu_crtc->dev, "failed to acquire vblank counter\n");
- list_del(&event->base.link);
-
- return ret;
+ goto out;
}
ipu_crtc->newfb = fb;
ipu_crtc->page_flip_event = event;
- return 0;
+out:
+ spin_unlock_irqrestore(&drm->event_lock, flags);
+ return ret;
}
static const struct drm_crtc_funcs ipu_crtc_funcs = {
--
1.7.9.5
More information about the dri-devel
mailing list