Re: [PATCH 02/15] drm/mode: move framebuffer_free up above framebuffer_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 15, 2016 at 03:10:33PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@xxxxxxxxxx>
> 
> A later patch will use it in framebuffer_init, and I want
> to keep the diff cleaner.
> 
> Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>

Acked-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
> ---
>  drivers/gpu/drm/drm_crtc.c | 58 +++++++++++++++++++++++-----------------------
>  1 file changed, 29 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 21cb8dc..e69aac4 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -389,6 +389,35 @@ struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
>  }
>  EXPORT_SYMBOL(drm_mode_object_find);
>  
> +/* dev->mode_config.fb_lock must be held! */
> +static void __drm_framebuffer_unregister(struct drm_device *dev,
> +					 struct drm_framebuffer *fb)
> +{
> +	drm_mode_object_put(dev, &fb->base);
> +
> +	fb->base.id = 0;
> +}
> +
> +static void drm_framebuffer_free(struct kref *kref)
> +{
> +	struct drm_framebuffer *fb =
> +			container_of(kref, struct drm_framebuffer, refcount);
> +	struct drm_device *dev = fb->dev;
> +
> +	/*
> +	 * The lookup idr holds a weak reference, which has not necessarily been
> +	 * removed at this point. Check for that.
> +	 */
> +	mutex_lock(&dev->mode_config.fb_lock);
> +	if (fb->base.id) {
> +		/* Mark fb as reaped and drop idr ref. */
> +		__drm_framebuffer_unregister(dev, fb);
> +	}
> +	mutex_unlock(&dev->mode_config.fb_lock);
> +
> +	fb->funcs->destroy(fb);
> +}
> +
>  /**
>   * drm_framebuffer_init - initialize a framebuffer
>   * @dev: DRM device
> @@ -431,35 +460,6 @@ out:
>  }
>  EXPORT_SYMBOL(drm_framebuffer_init);
>  
> -/* dev->mode_config.fb_lock must be held! */
> -static void __drm_framebuffer_unregister(struct drm_device *dev,
> -					 struct drm_framebuffer *fb)
> -{
> -	drm_mode_object_put(dev, &fb->base);
> -
> -	fb->base.id = 0;
> -}
> -
> -static void drm_framebuffer_free(struct kref *kref)
> -{
> -	struct drm_framebuffer *fb =
> -			container_of(kref, struct drm_framebuffer, refcount);
> -	struct drm_device *dev = fb->dev;
> -
> -	/*
> -	 * The lookup idr holds a weak reference, which has not necessarily been
> -	 * removed at this point. Check for that.
> -	 */
> -	mutex_lock(&dev->mode_config.fb_lock);
> -	if (fb->base.id) {
> -		/* Mark fb as reaped and drop idr ref. */
> -		__drm_framebuffer_unregister(dev, fb);
> -	}
> -	mutex_unlock(&dev->mode_config.fb_lock);
> -
> -	fb->funcs->destroy(fb);
> -}
> -
>  static struct drm_framebuffer *__drm_framebuffer_lookup(struct drm_device *dev,
>  							uint32_t id)
>  {
> -- 
> 2.5.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux