diff mbox series

[7/7] drm/tidss: Rename 'wait_lock' to 'irq_lock'

Message ID 20241021-tidss-irq-fix-v1-7-82ddaec94e4a@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series drm/tidss: Interrupt fixes and cleanups | expand

Commit Message

Tomi Valkeinen Oct. 21, 2024, 2:07 p.m. UTC
The 'wait_lock' name seems to be a copy-paste from omapdrm, and makes no
sense here. Rename it to 'irq_lock'. Also clarify the related comment to
make it clear what it protects, and drop any comments related to
'wait_list' which doesn't exist in tidss.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/tidss/tidss_dispc.c |  4 ++--
 drivers/gpu/drm/tidss/tidss_drv.c   |  2 +-
 drivers/gpu/drm/tidss/tidss_drv.h   |  5 +++--
 drivers/gpu/drm/tidss/tidss_irq.c   | 19 +++++++++----------
 4 files changed, 15 insertions(+), 15 deletions(-)

Comments

Devarsh Thakkar Nov. 22, 2024, 8:09 a.m. UTC | #1
On 21/10/24 19:37, Tomi Valkeinen wrote:
> The 'wait_lock' name seems to be a copy-paste from omapdrm, and makes no
> sense here. Rename it to 'irq_lock'. Also clarify the related comment to
> make it clear what it protects, and drop any comments related to
> 'wait_list' which doesn't exist in tidss.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Reviewed-by: Devarsh Thakkar <devarsht@ti.com>

Regards
Devarsh
> ---
>  drivers/gpu/drm/tidss/tidss_dispc.c |  4 ++--
>  drivers/gpu/drm/tidss/tidss_drv.c   |  2 +-
>  drivers/gpu/drm/tidss/tidss_drv.h   |  5 +++--
>  drivers/gpu/drm/tidss/tidss_irq.c   | 19 +++++++++----------
>  4 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c
> index 07f5c26cfa26..cacb5f3d8085 100644
> --- a/drivers/gpu/drm/tidss/tidss_dispc.c
> +++ b/drivers/gpu/drm/tidss/tidss_dispc.c
> @@ -2769,10 +2769,10 @@ static void dispc_softreset_k2g(struct dispc_device *dispc)
>  {
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&dispc->tidss->wait_lock, flags);
> +	spin_lock_irqsave(&dispc->tidss->irq_lock, flags);
>  	dispc_set_irqenable(dispc, 0);
>  	dispc_read_and_clear_irqstatus(dispc);
> -	spin_unlock_irqrestore(&dispc->tidss->wait_lock, flags);
> +	spin_unlock_irqrestore(&dispc->tidss->irq_lock, flags);
>  
>  	for (unsigned int vp_idx = 0; vp_idx < dispc->feat->num_vps; ++vp_idx)
>  		VP_REG_FLD_MOD(dispc, vp_idx, DISPC_VP_CONTROL, 0, 0, 0);
> diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
> index d15f836dca95..c7de8c9fa12e 100644
> --- a/drivers/gpu/drm/tidss/tidss_drv.c
> +++ b/drivers/gpu/drm/tidss/tidss_drv.c
> @@ -138,7 +138,7 @@ static int tidss_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, tidss);
>  
> -	spin_lock_init(&tidss->wait_lock);
> +	spin_lock_init(&tidss->irq_lock);
>  
>  	ret = dispc_init(tidss);
>  	if (ret) {
> diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h
> index d7f27b0b0315..7f4f4282bc04 100644
> --- a/drivers/gpu/drm/tidss/tidss_drv.h
> +++ b/drivers/gpu/drm/tidss/tidss_drv.h
> @@ -29,8 +29,9 @@ struct tidss_device {
>  
>  	unsigned int irq;
>  
> -	spinlock_t wait_lock;	/* protects the irq masks */
> -	dispc_irq_t irq_mask;	/* enabled irqs in addition to wait_list */
> +	/* protects the irq masks field and irqenable/irqstatus registers */
> +	spinlock_t irq_lock;
> +	dispc_irq_t irq_mask;	/* enabled irqs */
>  };
>  
>  #define to_tidss(__dev) container_of(__dev, struct tidss_device, ddev)
> diff --git a/drivers/gpu/drm/tidss/tidss_irq.c b/drivers/gpu/drm/tidss/tidss_irq.c
> index 8af4682ba56b..5abc788781f4 100644
> --- a/drivers/gpu/drm/tidss/tidss_irq.c
> +++ b/drivers/gpu/drm/tidss/tidss_irq.c
> @@ -15,10 +15,9 @@
>  #include "tidss_irq.h"
>  #include "tidss_plane.h"
>  
> -/* call with wait_lock and dispc runtime held */
>  static void tidss_irq_update(struct tidss_device *tidss)
>  {
> -	assert_spin_locked(&tidss->wait_lock);
> +	assert_spin_locked(&tidss->irq_lock);
>  
>  	dispc_set_irqenable(tidss->dispc, tidss->irq_mask);
>  }
> @@ -31,11 +30,11 @@ void tidss_irq_enable_vblank(struct drm_crtc *crtc)
>  	u32 hw_videoport = tcrtc->hw_videoport;
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&tidss->wait_lock, flags);
> +	spin_lock_irqsave(&tidss->irq_lock, flags);
>  	tidss->irq_mask |= DSS_IRQ_VP_VSYNC_EVEN(hw_videoport) |
>  			   DSS_IRQ_VP_VSYNC_ODD(hw_videoport);
>  	tidss_irq_update(tidss);
> -	spin_unlock_irqrestore(&tidss->wait_lock, flags);
> +	spin_unlock_irqrestore(&tidss->irq_lock, flags);
>  }
>  
>  void tidss_irq_disable_vblank(struct drm_crtc *crtc)
> @@ -46,11 +45,11 @@ void tidss_irq_disable_vblank(struct drm_crtc *crtc)
>  	u32 hw_videoport = tcrtc->hw_videoport;
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&tidss->wait_lock, flags);
> +	spin_lock_irqsave(&tidss->irq_lock, flags);
>  	tidss->irq_mask &= ~(DSS_IRQ_VP_VSYNC_EVEN(hw_videoport) |
>  			     DSS_IRQ_VP_VSYNC_ODD(hw_videoport));
>  	tidss_irq_update(tidss);
> -	spin_unlock_irqrestore(&tidss->wait_lock, flags);
> +	spin_unlock_irqrestore(&tidss->irq_lock, flags);
>  }
>  
>  static irqreturn_t tidss_irq_handler(int irq, void *arg)
> @@ -60,9 +59,9 @@ static irqreturn_t tidss_irq_handler(int irq, void *arg)
>  	unsigned int id;
>  	dispc_irq_t irqstatus;
>  
> -	spin_lock(&tidss->wait_lock);
> +	spin_lock(&tidss->irq_lock);
>  	irqstatus = dispc_read_and_clear_irqstatus(tidss->dispc);
> -	spin_unlock(&tidss->wait_lock);
> +	spin_unlock(&tidss->irq_lock);
>  
>  	for (id = 0; id < tidss->num_crtcs; id++) {
>  		struct drm_crtc *crtc = tidss->crtcs[id];
> @@ -95,9 +94,9 @@ void tidss_irq_resume(struct tidss_device *tidss)
>  {
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&tidss->wait_lock, flags);
> +	spin_lock_irqsave(&tidss->irq_lock, flags);
>  	tidss_irq_update(tidss);
> -	spin_unlock_irqrestore(&tidss->wait_lock, flags);
> +	spin_unlock_irqrestore(&tidss->irq_lock, flags);
>  }
>  
>  int tidss_irq_install(struct drm_device *ddev, unsigned int irq)
>
Aradhya Bhatia Nov. 24, 2024, 5:30 p.m. UTC | #2
On 10/21/24 19:37, Tomi Valkeinen wrote:
> The 'wait_lock' name seems to be a copy-paste from omapdrm, and makes no
> sense here. Rename it to 'irq_lock'. Also clarify the related comment to
> make it clear what it protects, and drop any comments related to
> 'wait_list' which doesn't exist in tidss.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Reviewed-by: Aradhya Bhatia <aradhya.bhatia@linux.dev>

Regards
Aradhya

[...]
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c
index 07f5c26cfa26..cacb5f3d8085 100644
--- a/drivers/gpu/drm/tidss/tidss_dispc.c
+++ b/drivers/gpu/drm/tidss/tidss_dispc.c
@@ -2769,10 +2769,10 @@  static void dispc_softreset_k2g(struct dispc_device *dispc)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&dispc->tidss->wait_lock, flags);
+	spin_lock_irqsave(&dispc->tidss->irq_lock, flags);
 	dispc_set_irqenable(dispc, 0);
 	dispc_read_and_clear_irqstatus(dispc);
-	spin_unlock_irqrestore(&dispc->tidss->wait_lock, flags);
+	spin_unlock_irqrestore(&dispc->tidss->irq_lock, flags);
 
 	for (unsigned int vp_idx = 0; vp_idx < dispc->feat->num_vps; ++vp_idx)
 		VP_REG_FLD_MOD(dispc, vp_idx, DISPC_VP_CONTROL, 0, 0, 0);
diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
index d15f836dca95..c7de8c9fa12e 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.c
+++ b/drivers/gpu/drm/tidss/tidss_drv.c
@@ -138,7 +138,7 @@  static int tidss_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, tidss);
 
-	spin_lock_init(&tidss->wait_lock);
+	spin_lock_init(&tidss->irq_lock);
 
 	ret = dispc_init(tidss);
 	if (ret) {
diff --git a/drivers/gpu/drm/tidss/tidss_drv.h b/drivers/gpu/drm/tidss/tidss_drv.h
index d7f27b0b0315..7f4f4282bc04 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.h
+++ b/drivers/gpu/drm/tidss/tidss_drv.h
@@ -29,8 +29,9 @@  struct tidss_device {
 
 	unsigned int irq;
 
-	spinlock_t wait_lock;	/* protects the irq masks */
-	dispc_irq_t irq_mask;	/* enabled irqs in addition to wait_list */
+	/* protects the irq masks field and irqenable/irqstatus registers */
+	spinlock_t irq_lock;
+	dispc_irq_t irq_mask;	/* enabled irqs */
 };
 
 #define to_tidss(__dev) container_of(__dev, struct tidss_device, ddev)
diff --git a/drivers/gpu/drm/tidss/tidss_irq.c b/drivers/gpu/drm/tidss/tidss_irq.c
index 8af4682ba56b..5abc788781f4 100644
--- a/drivers/gpu/drm/tidss/tidss_irq.c
+++ b/drivers/gpu/drm/tidss/tidss_irq.c
@@ -15,10 +15,9 @@ 
 #include "tidss_irq.h"
 #include "tidss_plane.h"
 
-/* call with wait_lock and dispc runtime held */
 static void tidss_irq_update(struct tidss_device *tidss)
 {
-	assert_spin_locked(&tidss->wait_lock);
+	assert_spin_locked(&tidss->irq_lock);
 
 	dispc_set_irqenable(tidss->dispc, tidss->irq_mask);
 }
@@ -31,11 +30,11 @@  void tidss_irq_enable_vblank(struct drm_crtc *crtc)
 	u32 hw_videoport = tcrtc->hw_videoport;
 	unsigned long flags;
 
-	spin_lock_irqsave(&tidss->wait_lock, flags);
+	spin_lock_irqsave(&tidss->irq_lock, flags);
 	tidss->irq_mask |= DSS_IRQ_VP_VSYNC_EVEN(hw_videoport) |
 			   DSS_IRQ_VP_VSYNC_ODD(hw_videoport);
 	tidss_irq_update(tidss);
-	spin_unlock_irqrestore(&tidss->wait_lock, flags);
+	spin_unlock_irqrestore(&tidss->irq_lock, flags);
 }
 
 void tidss_irq_disable_vblank(struct drm_crtc *crtc)
@@ -46,11 +45,11 @@  void tidss_irq_disable_vblank(struct drm_crtc *crtc)
 	u32 hw_videoport = tcrtc->hw_videoport;
 	unsigned long flags;
 
-	spin_lock_irqsave(&tidss->wait_lock, flags);
+	spin_lock_irqsave(&tidss->irq_lock, flags);
 	tidss->irq_mask &= ~(DSS_IRQ_VP_VSYNC_EVEN(hw_videoport) |
 			     DSS_IRQ_VP_VSYNC_ODD(hw_videoport));
 	tidss_irq_update(tidss);
-	spin_unlock_irqrestore(&tidss->wait_lock, flags);
+	spin_unlock_irqrestore(&tidss->irq_lock, flags);
 }
 
 static irqreturn_t tidss_irq_handler(int irq, void *arg)
@@ -60,9 +59,9 @@  static irqreturn_t tidss_irq_handler(int irq, void *arg)
 	unsigned int id;
 	dispc_irq_t irqstatus;
 
-	spin_lock(&tidss->wait_lock);
+	spin_lock(&tidss->irq_lock);
 	irqstatus = dispc_read_and_clear_irqstatus(tidss->dispc);
-	spin_unlock(&tidss->wait_lock);
+	spin_unlock(&tidss->irq_lock);
 
 	for (id = 0; id < tidss->num_crtcs; id++) {
 		struct drm_crtc *crtc = tidss->crtcs[id];
@@ -95,9 +94,9 @@  void tidss_irq_resume(struct tidss_device *tidss)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&tidss->wait_lock, flags);
+	spin_lock_irqsave(&tidss->irq_lock, flags);
 	tidss_irq_update(tidss);
-	spin_unlock_irqrestore(&tidss->wait_lock, flags);
+	spin_unlock_irqrestore(&tidss->irq_lock, flags);
 }
 
 int tidss_irq_install(struct drm_device *ddev, unsigned int irq)