lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170811161143.m6vpsu6el23p2w6j@phenom.ffwll.local>
Date:   Fri, 11 Aug 2017 18:11:43 +0200
From:   Daniel Vetter <daniel@...ll.ch>
To:     Cihangir Akturk <cakturk@...il.com>
Cc:     daniel@...ll.ch, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org,
        Daniel Vetter <daniel.vetter@...el.com>,
        Jani Nikula <jani.nikula@...ux.intel.com>,
        David Airlie <airlied@...ux.ie>,
        intel-gfx@...ts.freedesktop.org
Subject: Re: [PATCH v3 11/28] drm/i915: switch to drm_*_get(), drm_*_put()
 helpers

On Fri, Aug 11, 2017 at 03:32:57PM +0300, Cihangir Akturk wrote:
> Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference()
> and drm_*_unreference() helpers.
> 
> drm_*_reference() and drm_*_unreference() functions are just
> compatibility alias for drm_*_get() and drm_*_put() and should not be
> used by new code. So convert all users of compatibility functions to
> use the new APIs.
> 
> Generated by: scripts/coccinelle/api/drm-get-put.cocci
> 
> Signed-off-by: Cihangir Akturk <cakturk@...il.com>

Seems this is against a rather old version of drm/i915. Can you pls
regenerate against linux-next or the drm-tip branch from

https://cgit.freedesktop.org/drm-tip

But in general, for large-scale refactoring like this, the recommendation
is to base them on linux-next, since that will have all pending patches
applied for every part of the kernel.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem_object.h |  4 ++--
>  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, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h
> index 5b19a49..95cfb64 100644
> --- a/drivers/gpu/drm/i915/i915_gem_object.h
> +++ b/drivers/gpu/drm/i915/i915_gem_object.h
> @@ -257,7 +257,7 @@ __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;
>  }
>  
> @@ -268,7 +268,7 @@ __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
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 684d653..70ebc19 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;
>  
> @@ -9683,7 +9683,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;
> @@ -9864,7 +9864,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)
> @@ -10174,7 +10174,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);
> @@ -10814,7 +10814,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);
> @@ -10928,7 +10928,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;
> @@ -11252,7 +11252,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 =
> @@ -11260,7 +11260,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 5856855..99a6fd8 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -501,7 +501,7 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
>  	intel_connector->mst_port = NULL;
>  	drm_modeset_unlock(&connector->dev->mode_config.connection_mutex);
>  
> -	drm_connector_unreference(connector);
> +	drm_connector_put(connector);
>  	DRM_DEBUG_KMS("\n");
>  }
>  
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 0986ca4..5568e33 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)) {
> @@ -626,7 +626,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) {
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ