[Intel-gfx] [PATCH 1/5] drm: Use correct spinlock flavor in drm_vblank_get()

Jesse Barnes jbarnes at virtuousgeek.org
Wed Feb 26 20:24:44 CET 2014


On Fri, 21 Feb 2014 21:03:31 +0200
ville.syrjala at linux.intel.com wrote:

> From: Peter Hurley <peter at hurleysoftware.com>
> 
> The irq flags state is already established by the outer
> spin_lock_irqsave(); re-disabling irqs is redundant.
> 
> Signed-off-by: Peter Hurley <peter at hurleysoftware.com>
> ---
>  drivers/gpu/drm/drm_irq.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index c2676b5..baa12e7 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -882,13 +882,13 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)
>   */
>  int drm_vblank_get(struct drm_device *dev, int crtc)
>  {
> -	unsigned long irqflags, irqflags2;
> +	unsigned long irqflags;
>  	int ret = 0;
>  
>  	spin_lock_irqsave(&dev->vbl_lock, irqflags);
>  	/* Going from 0->1 means we have to enable interrupts again */
>  	if (atomic_add_return(1, &dev->vblank[crtc].refcount) == 1) {
> -		spin_lock_irqsave(&dev->vblank_time_lock, irqflags2);
> +		spin_lock(&dev->vblank_time_lock);
>  		if (!dev->vblank[crtc].enabled) {
>  			/* Enable vblank irqs under vblank_time_lock protection.
>  			 * All vblank count & timestamp updates are held off
> @@ -906,7 +906,7 @@ int drm_vblank_get(struct drm_device *dev, int crtc)
>  				drm_update_vblank_count(dev, crtc);
>  			}
>  		}
> -		spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags2);
> +		spin_unlock(&dev->vblank_time_lock);
>  	} else {
>  		if (!dev->vblank[crtc].enabled) {
>  			atomic_dec(&dev->vblank[crtc].refcount);

Reviewed-by: Jesse Barnes <jbarnes at virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center



More information about the Intel-gfx mailing list