Re: [PATCH 4/5] drm/vblank: Use spin_(un)lock_irq() in drm_queue_vblank_event()

2020-07-21 Thread Daniel Vetter
On Mon, Jul 20, 2020 at 03:07:35PM -0400, Lyude Paul wrote:
> This one's easy - we're already calling kzalloc() in this function, so

Nit: "kzalloc(GFP_KERNEL)", since kzalloc(GFP_ATOMIC) is perfectly fine in
interrupt context. With that clarified for the entire series:

Reviewed-by: Daniel Vetter 

> we must already be guaranteed to have IRQs enabled when calling this.
> So, use the plain _irq() variants of spin_(un)lock() to make this more
> obvious.
> 
> Signed-off-by: Lyude Paul 
> Cc: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_vblank.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 51f2e988205e7..64610070ba473 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -1611,7 +1611,6 @@ static int drm_queue_vblank_event(struct drm_device 
> *dev, unsigned int pipe,
>   struct drm_vblank_crtc *vblank = >vblank[pipe];
>   struct drm_pending_vblank_event *e;
>   ktime_t now;
> - unsigned long flags;
>   u64 seq;
>   int ret;
>  
> @@ -1633,7 +1632,7 @@ static int drm_queue_vblank_event(struct drm_device 
> *dev, unsigned int pipe,
>   e->event.vbl.crtc_id = crtc->base.id;
>   }
>  
> - spin_lock_irqsave(>event_lock, flags);
> + spin_lock_irq(>event_lock);
>  
>   /*
>* drm_crtc_vblank_off() might have been called after we called
> @@ -1670,12 +1669,12 @@ static int drm_queue_vblank_event(struct drm_device 
> *dev, unsigned int pipe,
>   vblwait->reply.sequence = req_seq;
>   }
>  
> - spin_unlock_irqrestore(>event_lock, flags);
> + spin_unlock_irq(>event_lock);
>  
>   return 0;
>  
>  err_unlock:
> - spin_unlock_irqrestore(>event_lock, flags);
> + spin_unlock_irq(>event_lock);
>   kfree(e);
>  err_put:
>   drm_vblank_put(dev, pipe);
> -- 
> 2.26.2
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/5] drm/vblank: Use spin_(un)lock_irq() in drm_queue_vblank_event()

2020-07-20 Thread Lyude Paul
This one's easy - we're already calling kzalloc() in this function, so
we must already be guaranteed to have IRQs enabled when calling this.
So, use the plain _irq() variants of spin_(un)lock() to make this more
obvious.

Signed-off-by: Lyude Paul 
Cc: Daniel Vetter 
---
 drivers/gpu/drm/drm_vblank.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 51f2e988205e7..64610070ba473 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1611,7 +1611,6 @@ static int drm_queue_vblank_event(struct drm_device *dev, 
unsigned int pipe,
struct drm_vblank_crtc *vblank = >vblank[pipe];
struct drm_pending_vblank_event *e;
ktime_t now;
-   unsigned long flags;
u64 seq;
int ret;
 
@@ -1633,7 +1632,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, 
unsigned int pipe,
e->event.vbl.crtc_id = crtc->base.id;
}
 
-   spin_lock_irqsave(>event_lock, flags);
+   spin_lock_irq(>event_lock);
 
/*
 * drm_crtc_vblank_off() might have been called after we called
@@ -1670,12 +1669,12 @@ static int drm_queue_vblank_event(struct drm_device 
*dev, unsigned int pipe,
vblwait->reply.sequence = req_seq;
}
 
-   spin_unlock_irqrestore(>event_lock, flags);
+   spin_unlock_irq(>event_lock);
 
return 0;
 
 err_unlock:
-   spin_unlock_irqrestore(>event_lock, flags);
+   spin_unlock_irq(>event_lock);
kfree(e);
 err_put:
drm_vblank_put(dev, pipe);
-- 
2.26.2

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