[Intel-gfx] [PATCH 2/2] drm/i915/guc: prefer 'dev_priv' to 'dev' for intra-module functions

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Mon Jun 13 09:15:38 UTC 2016


On 10/06/16 18:29, Dave Gordon wrote:
> There are four non-static functions in i915_guc_submission.c that take a
> 'dev' parameter. All are called only from GuC loader code, and can be
> easily converted to accept 'dev_priv' instead.
>
> Signed-off-by: Dave Gordon <david.s.gordon at intel.com>
> ---
>   drivers/gpu/drm/i915/i915_guc_submission.c | 14 +++++---------
>   drivers/gpu/drm/i915/intel_guc.h           |  8 ++++----
>   drivers/gpu/drm/i915/intel_guc_loader.c    | 12 ++++++------
>   3 files changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
> index 1bd0fac..65e67f0 100644
> --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> @@ -906,9 +906,8 @@ static void guc_create_ads(struct intel_guc *guc)
>    * Set up the memory resources to be shared with the GuC.  At this point,
>    * we require just one object that can be mapped through the GGTT.
>    */
> -int i915_guc_submission_init(struct drm_device *dev)
> +int i915_guc_submission_init(struct drm_i915_private *dev_priv)
>   {
> -	struct drm_i915_private *dev_priv = dev->dev_private;
>   	const size_t ctxsize = sizeof(struct guc_context_desc);
>   	const size_t poolsize = GUC_MAX_GPU_CONTEXTS * ctxsize;
>   	const size_t gemsize = round_up(poolsize, PAGE_SIZE);
> @@ -916,7 +915,7 @@ int i915_guc_submission_init(struct drm_device *dev)
>
>   	/* Wipe bitmap & delete client in case of reinitialisation */
>   	bitmap_clear(guc->doorbell_bitmap, 0, GUC_MAX_DOORBELLS);
> -	i915_guc_submission_disable(dev);
> +	i915_guc_submission_disable(dev_priv);
>
>   	if (!i915.enable_guc_submission)
>   		return 0; /* not enabled  */
> @@ -935,9 +934,8 @@ int i915_guc_submission_init(struct drm_device *dev)
>   	return 0;
>   }
>
> -int i915_guc_submission_enable(struct drm_device *dev)
> +int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
>   {
> -	struct drm_i915_private *dev_priv = dev->dev_private;
>   	struct intel_guc *guc = &dev_priv->guc;
>   	struct i915_guc_client *client;
>
> @@ -957,18 +955,16 @@ int i915_guc_submission_enable(struct drm_device *dev)
>   	return 0;
>   }
>
> -void i915_guc_submission_disable(struct drm_device *dev)
> +void i915_guc_submission_disable(struct drm_i915_private *dev_priv)
>   {
> -	struct drm_i915_private *dev_priv = dev->dev_private;
>   	struct intel_guc *guc = &dev_priv->guc;
>
>   	guc_client_free(dev_priv, guc->execbuf_client);
>   	guc->execbuf_client = NULL;
>   }
>
> -void i915_guc_submission_fini(struct drm_device *dev)
> +void i915_guc_submission_fini(struct drm_i915_private *dev_priv)
>   {
> -	struct drm_i915_private *dev_priv = dev->dev_private;
>   	struct intel_guc *guc = &dev_priv->guc;
>
>   	gem_release_guc_obj(dev_priv->guc.ads_obj);
> diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h
> index 41601c7..4df80cc 100644
> --- a/drivers/gpu/drm/i915/intel_guc.h
> +++ b/drivers/gpu/drm/i915/intel_guc.h
> @@ -156,11 +156,11 @@ extern int intel_guc_suspend(struct drm_device *dev);
>   extern int intel_guc_resume(struct drm_device *dev);
>
>   /* i915_guc_submission.c */
> -int i915_guc_submission_init(struct drm_device *dev);
> -int i915_guc_submission_enable(struct drm_device *dev);
> +int i915_guc_submission_init(struct drm_i915_private *dev_priv);
> +int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
>   int i915_guc_wq_check_space(struct drm_i915_gem_request *rq);
>   int i915_guc_submit(struct drm_i915_gem_request *rq);
> -void i915_guc_submission_disable(struct drm_device *dev);
> -void i915_guc_submission_fini(struct drm_device *dev);
> +void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
> +void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
>
>   #endif
> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
> index 41f7c7d..d29137f 100644
> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
> @@ -453,7 +453,7 @@ int intel_guc_setup(struct drm_device *dev)
>   		intel_guc_fw_status_repr(guc_fw->guc_fw_fetch_status),
>   		intel_guc_fw_status_repr(guc_fw->guc_fw_load_status));
>
> -	err = i915_guc_submission_init(dev);
> +	err = i915_guc_submission_init(dev_priv);
>   	if (err)
>   		goto fail;
>
> @@ -492,7 +492,7 @@ int intel_guc_setup(struct drm_device *dev)
>   		intel_guc_fw_status_repr(guc_fw->guc_fw_load_status));
>
>   	if (i915.enable_guc_submission) {
> -		err = i915_guc_submission_enable(dev);
> +		err = i915_guc_submission_enable(dev_priv);
>   		if (err)
>   			goto fail;
>   		direct_interrupts_to_guc(dev_priv);
> @@ -505,8 +505,8 @@ int intel_guc_setup(struct drm_device *dev)
>   		guc_fw->guc_fw_load_status = GUC_FIRMWARE_FAIL;
>
>   	direct_interrupts_to_host(dev_priv);
> -	i915_guc_submission_disable(dev);
> -	i915_guc_submission_fini(dev);
> +	i915_guc_submission_disable(dev_priv);
> +	i915_guc_submission_fini(dev_priv);
>
>   	/*
>   	 * We've failed to load the firmware :(
> @@ -731,8 +731,8 @@ void intel_guc_fini(struct drm_device *dev)
>
>   	mutex_lock(&dev->struct_mutex);
>   	direct_interrupts_to_host(dev_priv);
> -	i915_guc_submission_disable(dev);
> -	i915_guc_submission_fini(dev);
> +	i915_guc_submission_disable(dev_priv);
> +	i915_guc_submission_fini(dev_priv);
>
>   	if (guc_fw->guc_fw_obj)
>   		drm_gem_object_unreference(&guc_fw->guc_fw_obj->base);
>

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the Intel-gfx mailing list