diff mbox

drm/i915: Eliminate dead code in intel_sanitize_enable_ppgtt()

Message ID 1464796873-12905-1-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien June 1, 2016, 4:01 p.m. UTC
We exit early if has_aliasing_ppgtt is 0, so towards the end of the
function has_aliasing_ppgtt can only be 1.

Also:

	if (foo)
		return 1;
	else
		return 0;

when foo is already a bool is really just:

	return foo;

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chris Wilson June 1, 2016, 5:04 p.m. UTC | #1
On Wed, Jun 01, 2016 at 05:01:13PM +0100, Damien Lespiau wrote:
> We exit early if has_aliasing_ppgtt is 0, so towards the end of the
> function has_aliasing_ppgtt can only be 1.
> 
> Also:
> 
> 	if (foo)
> 		return 1;
> 	else
> 		return 0;
> 
> when foo is already a bool is really just:
> 
> 	return foo;
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 4668477..6aae4b8 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -161,7 +161,7 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
>  	if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists)
>  		return has_full_48bit_ppgtt ? 3 : 2;
>  	else
> -		return has_aliasing_ppgtt ? 1 : 0;
> +		return has_aliasing_ppgtt;

/* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */
if (!i915.enable_execlists)
	return 1;

return has_full_48bit_ppgtt ? 3 : 2;
Imre Deak July 17, 2017, noon UTC | #2
On Wed, Jun 01, 2016 at 06:04:40PM +0100, Chris Wilson wrote:
> On Wed, Jun 01, 2016 at 05:01:13PM +0100, Damien Lespiau wrote:
> > We exit early if has_aliasing_ppgtt is 0, so towards the end of the
> > function has_aliasing_ppgtt can only be 1.
> > 
> > Also:
> > 
> > 	if (foo)
> > 		return 1;
> > 	else
> > 		return 0;
> > 
> > when foo is already a bool is really just:
> > 
> > 	return foo;
> > 
> > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index 4668477..6aae4b8 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -161,7 +161,7 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
> >  	if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists)
> >  		return has_full_48bit_ppgtt ? 3 : 2;
> >  	else
> > -		return has_aliasing_ppgtt ? 1 : 0;
> > +		return has_aliasing_ppgtt;
> 
> /* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */
> if (!i915.enable_execlists)
> 	return 1;
> 
> return has_full_48bit_ppgtt ? 3 : 2;

This fell through the cracks. We'd need it to improve the output from
static checkers.

--Imre

> 
> -- 
> Chris Wilson, Intel Open Source Technology Centre
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 4668477..6aae4b8 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -161,7 +161,7 @@  int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 	if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists)
 		return has_full_48bit_ppgtt ? 3 : 2;
 	else
-		return has_aliasing_ppgtt ? 1 : 0;
+		return has_aliasing_ppgtt;
 }
 
 static int ppgtt_bind_vma(struct i915_vma *vma,