[PATCH 8/9] drm/omap: fix preclose to wait for scheduled work

Tomi Valkeinen tomi.valkeinen at ti.com
Wed Sep 3 04:55:09 PDT 2014


We already wait for all scheduled work to be done on the driver's unload
function. However, I think we need to wait on preclose() also, so that
when an application closes the drm file descriptor, we are sure that
there's no left around.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 26fda74c1e48..f59fa6600cf8 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -594,7 +594,20 @@ static void dev_lastclose(struct drm_device *dev)
 
 static void dev_preclose(struct drm_device *dev, struct drm_file *file)
 {
+	struct omap_drm_private *priv = dev->dev_private;
+	int i;
+
 	DBG("preclose: dev=%p", dev);
+
+	/*
+	 * Flush crtcs to finish any pending work.
+	 * Note: this may not be correct if there are multiple applications
+	 * using the drm device, and could possibly result in a timeout from
+	 * omap_crtc_flush() if an other application is actively queuing new
+	 * work.
+	 */
+	for (i = 0; i < priv->num_crtcs; i++)
+		omap_crtc_flush(priv->crtcs[i]);
 }
 
 static void dev_postclose(struct drm_device *dev, struct drm_file *file)
-- 
1.9.1



More information about the dri-devel mailing list