Skip to contentSkip to conversation

drm: Set crc->opened to false before setting crc source to NULL.

PATCH Superseded David (Dingchen) Zhang 2 participants 2 messages Jul 26, 2019

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm: Set crc->opened to false before setting crc source to NULL.

From: Dingchen Zhang <[email protected]>

to terminate the while-loop in drm_dp_aux_crc_work when drm_dp_start/stop_crc are called in the hook to set crc source.

v2: Move spin_lock around entire crc->opened use (Daniel)

Cc Daniel Vetter <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Nick Kazlauskas <[email protected]>
---
 drivers/gpu/drm/drm_debugfs_crc.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_debugfs_crc.c +6 -0
index dac267e840af..f87148203599 100644
@@ -249,6 +249,12 @@ static int crtc_crc_release(struct inode *inode, struct file *filep)
 	struct drm_crtc *crtc = filep->f_inode->i_private;
 	struct drm_crtc_crc *crc = &crtc->crc;
 
+	/* terminate the infinite while loop if 'drm_dp_aux_crc_work' running */
+	spin_lock_irq(&crc->lock);
+	if (crc->opened)
+		crc->opened = false;
+	spin_unlock_irq(&crc->lock);
+
 	crtc->funcs->set_crc_source(crtc, NULL);
 
 	spin_lock_irq(&crc->lock);
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 20 lines · David (Dingchen) Zhang

From: Dingchen Zhang <[email protected]>

to terminate the while-loop in drm_dp_aux_crc_work when drm_dp_start/stop_crc are called in the hook to set crc source.

v2: Move spin_lock around entire crc->opened use (Daniel)

Cc Daniel Vetter <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Nick Kazlauskas <[email protected]>
---
  drivers/gpu/drm/drm_debugfs_crc.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_debugfs_crc.c +0 -0
index dac267e840af..f87148203599 100644

drivers/gpu/drm/drm_debugfs_crc.c static int crtc_crc_release(struct inode *inode, struct file *filep) · line 255

Quoted 7 lines
drivers/gpu/drm/drm_debugfs_crc.c +4 -0
@@ -249,6 +249,12 @@ static int crtc_crc_release(struct inode *inode, struct file *filep)
  	struct drm_crtc *crtc = filep->f_inode->i_private;
  	struct drm_crtc_crc *crc = &crtc->crc;
 
+	/* terminate the infinite while loop if 'drm_dp_aux_crc_work' running */
+	spin_lock_irq(&crc->lock);
+	if (crc->opened)
+		crc->opened = false;

You can just set this to false, no need to check the value really.

Nicholas Kazlauskas

drivers/gpu/drm/drm_debugfs_crc.c static int crtc_crc_release(struct inode *inode, struct file *filep) · line 260

Quoted 6 lines
drivers/gpu/drm/drm_debugfs_crc.c +2 -0
+	spin_unlock_irq(&crc->lock);
+
  	crtc->funcs->set_crc_source(crtc, NULL);
 
  	spin_lock_irq(&crc->lock);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel