[PATCH 09/11] drm/imx: page flip fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Rob Clark <rob@xxxxxx>

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@xxxxxx>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux