Re: [PATCH v2] drm: Set crc->opened to false before setting crc source to NULL.

2019-07-26 Thread Kazlauskas, Nicholas
On 7/26/19 12:02 PM, David (Dingchen) Zhang wrote:
> From: Dingchen Zhang 
> 
> 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 
> Cc: Harry Wentland 
> Cc: Nick Kazlauskas 
> Signed-off-by: Dingchen Zhang 
> ---
>   drivers/gpu/drm/drm_debugfs_crc.c | 6 ++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_debugfs_crc.c 
> b/drivers/gpu/drm/drm_debugfs_crc.c
> index dac267e840af..f87148203599 100644
> --- a/drivers/gpu/drm/drm_debugfs_crc.c
> +++ b/drivers/gpu/drm/drm_debugfs_crc.c
> @@ -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 = >crc;
>   
> + /* terminate the infinite while loop if 'drm_dp_aux_crc_work' running */
> + spin_lock_irq(>lock);
> + if (crc->opened)
> + crc->opened = false;

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

Nicholas Kazlauskas

> + spin_unlock_irq(>lock);
> +
>   crtc->funcs->set_crc_source(crtc, NULL);
>   
>   spin_lock_irq(>lock);
> 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

2019-07-26 Thread David (Dingchen) Zhang
From: Dingchen Zhang 

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 
Cc: Harry Wentland 
Cc: Nick Kazlauskas 
Signed-off-by: Dingchen Zhang 
---
 drivers/gpu/drm/drm_debugfs_crc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c 
b/drivers/gpu/drm/drm_debugfs_crc.c
index dac267e840af..f87148203599 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -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 = >crc;
 
+   /* terminate the infinite while loop if 'drm_dp_aux_crc_work' running */
+   spin_lock_irq(>lock);
+   if (crc->opened)
+   crc->opened = false;
+   spin_unlock_irq(>lock);
+
crtc->funcs->set_crc_source(crtc, NULL);
 
spin_lock_irq(>lock);
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel