Re: [PATCH 12/29] drm/i915: switch to drm_*{get, put} helpers

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

 



On Thu, 03 Aug 2017, Cihangir Akturk <cakturk@xxxxxxxxx> wrote:
> drm_*_reference() and drm_*_unreference() functions are just
> compatibility alias for drm_*_get() and drm_*_put() adn should not be
> used by new code. So convert all users of compatibility functions to use
> the new APIs.

Please include the cocci script in the commit message. If you didn't use
cocci, you should check it out! :)

BR,
Jani.

>
> Signed-off-by: Cihangir Akturk <cakturk@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_gem_object.h | 10 +++++-----
>  drivers/gpu/drm/i915/intel_display.c   | 24 ++++++++++++------------
>  drivers/gpu/drm/i915/intel_dp_mst.c    |  2 +-
>  drivers/gpu/drm/i915/intel_fbdev.c     |  4 ++--
>  4 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h
> index 5b19a49..8f6c915 100644
> --- a/drivers/gpu/drm/i915/i915_gem_object.h
> +++ b/drivers/gpu/drm/i915/i915_gem_object.h
> @@ -257,25 +257,25 @@ __attribute__((nonnull))
>  static inline struct drm_i915_gem_object *
>  i915_gem_object_get(struct drm_i915_gem_object *obj)
>  {
> -	drm_gem_object_reference(&obj->base);
> +	drm_gem_object_get(&obj->base);
>  	return obj;
>  }
>  
>  __deprecated
> -extern void drm_gem_object_reference(struct drm_gem_object *);
> +extern void drm_gem_object_get(struct drm_gem_object *);
>  
>  __attribute__((nonnull))
>  static inline void
>  i915_gem_object_put(struct drm_i915_gem_object *obj)
>  {
> -	__drm_gem_object_unreference(&obj->base);
> +	__drm_gem_object_put(&obj->base);
>  }
>  
>  __deprecated
> -extern void drm_gem_object_unreference(struct drm_gem_object *);
> +extern void drm_gem_object_put(struct drm_gem_object *);
>  
>  __deprecated
> -extern void drm_gem_object_unreference_unlocked(struct drm_gem_object *);
> +extern void drm_gem_object_put_unlocked(struct drm_gem_object *);
>  
>  static inline void i915_gem_object_lock(struct drm_i915_gem_object *obj)
>  {
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index dec9e58..b4d03cf 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2672,10 +2672,10 @@ update_state_fb(struct drm_plane *plane)
>  		return;
>  
>  	if (plane->state->fb)
> -		drm_framebuffer_unreference(plane->state->fb);
> +		drm_framebuffer_put(plane->state->fb);
>  	plane->state->fb = plane->fb;
>  	if (plane->state->fb)
> -		drm_framebuffer_reference(plane->state->fb);
> +		drm_framebuffer_get(plane->state->fb);
>  }
>  
>  static void
> @@ -2746,7 +2746,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  
>  		if (intel_plane_ggtt_offset(state) == plane_config->base) {
>  			fb = c->primary->fb;
> -			drm_framebuffer_reference(fb);
> +			drm_framebuffer_get(fb);
>  			goto valid_fb;
>  		}
>  	}
> @@ -2777,7 +2777,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  			  intel_crtc->pipe, PTR_ERR(intel_state->vma));
>  
>  		intel_state->vma = NULL;
> -		drm_framebuffer_unreference(fb);
> +		drm_framebuffer_put(fb);
>  		return;
>  	}
>  
> @@ -2798,7 +2798,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>  	if (i915_gem_object_is_tiled(obj))
>  		dev_priv->preserve_bios_swizzle = true;
>  
> -	drm_framebuffer_reference(fb);
> +	drm_framebuffer_get(fb);
>  	primary->fb = primary->state->fb = fb;
>  	primary->crtc = primary->state->crtc = &intel_crtc->base;
>  
> @@ -9668,7 +9668,7 @@ mode_fits_in_fbdev(struct drm_device *dev,
>  	if (obj->base.size < mode->vdisplay * fb->pitches[0])
>  		return NULL;
>  
> -	drm_framebuffer_reference(fb);
> +	drm_framebuffer_get(fb);
>  	return fb;
>  #else
>  	return NULL;
> @@ -9849,7 +9849,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
>  	if (ret)
>  		goto fail;
>  
> -	drm_framebuffer_unreference(fb);
> +	drm_framebuffer_put(fb);
>  
>  	ret = drm_atomic_set_mode_for_crtc(&crtc_state->base, mode);
>  	if (ret)
> @@ -10159,7 +10159,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
>  	intel_frontbuffer_flip_complete(to_i915(dev),
>  					to_intel_plane(primary)->frontbuffer_bit);
>  	intel_fbc_post_update(crtc);
> -	drm_framebuffer_unreference(work->old_fb);
> +	drm_framebuffer_put(work->old_fb);
>  
>  	BUG_ON(atomic_read(&crtc->unpin_work_count) == 0);
>  	atomic_dec(&crtc->unpin_work_count);
> @@ -10799,7 +10799,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
>  		flush_workqueue(dev_priv->wq);
>  
>  	/* Reference the objects for the scheduled work. */
> -	drm_framebuffer_reference(work->old_fb);
> +	drm_framebuffer_get(work->old_fb);
>  
>  	crtc->primary->fb = fb;
>  	update_state_fb(crtc->primary);
> @@ -10913,7 +10913,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
>  	update_state_fb(crtc->primary);
>  
>  	i915_gem_object_put(obj);
> -	drm_framebuffer_unreference(work->old_fb);
> +	drm_framebuffer_put(work->old_fb);
>  
>  	spin_lock_irq(&dev->event_lock);
>  	intel_crtc->flip_work = NULL;
> @@ -11237,7 +11237,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
>  	drm_connector_list_iter_begin(dev, &conn_iter);
>  	for_each_intel_connector_iter(connector, &conn_iter) {
>  		if (connector->base.state->crtc)
> -			drm_connector_unreference(&connector->base);
> +			drm_connector_put(&connector->base);
>  
>  		if (connector->base.encoder) {
>  			connector->base.state->best_encoder =
> @@ -11245,7 +11245,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
>  			connector->base.state->crtc =
>  				connector->base.encoder->crtc;
>  
> -			drm_connector_reference(&connector->base);
> +			drm_connector_get(&connector->base);
>  		} else {
>  			connector->base.state->best_encoder = NULL;
>  			connector->base.state->crtc = NULL;
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 2cf046b..b942578 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -524,7 +524,7 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
>  	intel_connector->mst_port = NULL;
>  	drm_modeset_unlock_all(dev);
>  
> -	drm_connector_unreference(&intel_connector->base);
> +	drm_connector_put(&intel_connector->base);
>  	DRM_DEBUG_KMS("\n");
>  }
>  
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 0c4cde6..13fbe80 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  			      " releasing it\n",
>  			      intel_fb->base.width, intel_fb->base.height,
>  			      sizes->fb_width, sizes->fb_height);
> -		drm_framebuffer_unreference(&intel_fb->base);
> +		drm_framebuffer_put(&intel_fb->base);
>  		intel_fb = ifbdev->fb = NULL;
>  	}
>  	if (!intel_fb || WARN_ON(!intel_fb->obj)) {
> @@ -650,7 +650,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
>  	ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
>  	ifbdev->fb = fb;
>  
> -	drm_framebuffer_reference(&ifbdev->fb->base);
> +	drm_framebuffer_get(&ifbdev->fb->base);
>  
>  	/* Final pass to check if any active pipes don't have fbs */
>  	for_each_crtc(dev, crtc) {

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux