Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH] drm/i915: Avoid compiler warning for maybe unused gu_misc_iir
Date: Wed, 26 Sep 2018 14:06:41 +0300	[thread overview]
Message-ID: <871s9gmsam.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180926104718.17462-1-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> /kisskb/src/drivers/gpu/drm/i915/i915_irq.c: warning: 'gu_misc_iir' may be used uninitialized in this function [-Wuninitialized]:  => 3120:10
>
> Silence the compiler warning by ensuring that the local variable is
> initialised and removing the guard that is confusing the older gcc.
>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Fixes: df0d28c185ad ("drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 33 ++++++++++++---------------------
>  1 file changed, 12 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 10f28a2ee2e6..2e242270e270 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -3088,36 +3088,27 @@ gen11_gt_irq_handler(struct drm_i915_private * const i915,
>  	spin_unlock(&i915->irq_lock);
>  }
>  
> -static void
> -gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32 master_ctl,
> -		      u32 *iir)
> +static u32
> +gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32 master_ctl)
>  {
>  	void __iomem * const regs = dev_priv->regs;
> +	u32 iir;
>  
>  	if (!(master_ctl & GEN11_GU_MISC_IRQ))
> -		return;
> +		return 0;
> +
> +	iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
> +	if (likely(iir))
> +		raw_reg_write(regs, GEN11_GU_MISC_IIR, iir);
>  
> -	*iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
> -	if (likely(*iir))
> -		raw_reg_write(regs, GEN11_GU_MISC_IIR, *iir);
> +	return iir;
>  }
>  
>  static void
> -gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
> -			  const u32 master_ctl, const u32 iir)
> +gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv, const u32 iir)
>  {
> -	if (!(master_ctl & GEN11_GU_MISC_IRQ))
> -		return;
> -
> -	if (unlikely(!iir)) {
> -		DRM_ERROR("GU_MISC iir blank!\n");
> -		return;
> -	}
> -
>  	if (iir & GEN11_GU_MISC_GSE)
>  		intel_opregion_asle_intr(dev_priv);
> -	else
> -		DRM_ERROR("Unexpected GU_MISC interrupt 0x%x\n", iir);

I see you are not fan of asserting irq behaviour in this
level.

You could have sprinked some 'static inline' there aswell but I
won't start to argue that I know better than compiler.

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

>  }
>  
>  static irqreturn_t gen11_irq_handler(int irq, void *arg)
> @@ -3154,12 +3145,12 @@ static irqreturn_t gen11_irq_handler(int irq, void *arg)
>  		enable_rpm_wakeref_asserts(i915);
>  	}
>  
> -	gen11_gu_misc_irq_ack(i915, master_ctl, &gu_misc_iir);
> +	gu_misc_iir = gen11_gu_misc_irq_ack(i915, master_ctl);
>  
>  	/* Acknowledge and enable interrupts. */
>  	raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl);
>  
> -	gen11_gu_misc_irq_handler(i915, master_ctl, gu_misc_iir);
> +	gen11_gu_misc_irq_handler(i915, gu_misc_iir);
>  
>  	return IRQ_HANDLED;
>  }
> -- 
> 2.19.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-09-26 11:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 10:47 [PATCH] drm/i915: Avoid compiler warning for maybe unused gu_misc_iir Chris Wilson
2018-09-26 11:06 ` Mika Kuoppala [this message]
2018-09-26 12:35   ` Chris Wilson
2018-09-26 11:45 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-09-26 12:06 ` ✓ Fi.CI.BAT: success " Patchwork
2018-09-26 13:53 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871s9gmsam.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox