Make sure we set suspended=true last to avoid generating an irq storm
in the unlikely case where an IRQ happens between the suspended=true
assignment and the _INT_MASK update.

v2:
- New patch

Reported-by: Steven Price <steven.pr...@arm.com>
Signed-off-by: Boris Brezillon <boris.brezil...@collabora.com>
---
 drivers/gpu/drm/panthor/panthor_device.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panthor/panthor_device.h 
b/drivers/gpu/drm/panthor/panthor_device.h
index 7ee4987a3796..3a930a368ae1 100644
--- a/drivers/gpu/drm/panthor/panthor_device.h
+++ b/drivers/gpu/drm/panthor/panthor_device.h
@@ -325,7 +325,7 @@ static inline void panthor_ ## __name ## 
_irq_suspend(struct panthor_irq *pirq)
 {                                                                              
                \
        int cookie;                                                             
                \
                                                                                
                \
-       atomic_set(&pirq->suspended, true);                                     
                \
+       pirq->mask = 0;                                                         
                \
                                                                                
                \
        if (drm_dev_enter(&pirq->ptdev->base, &cookie)) {                       
                \
                gpu_write(pirq->ptdev, __reg_prefix ## _INT_MASK, 0);           
                \
@@ -333,7 +333,7 @@ static inline void panthor_ ## __name ## 
_irq_suspend(struct panthor_irq *pirq)
                drm_dev_exit(cookie);                                           
                \
        }                                                                       
                \
                                                                                
                \
-       pirq->mask = 0;                                                         
                \
+       atomic_set(&pirq->suspended, true);                                     
                \
 }                                                                              
                \
                                                                                
                \
 static inline void panthor_ ## __name ## _irq_resume(struct panthor_irq *pirq, 
u32 mask)       \
-- 
2.44.0

Reply via email to