All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Disable -Woverride-init
@ 2017-01-18 12:18 Chris Wilson
  2017-01-18 12:18 ` [PATCH 2/2] drm/i915: Fix W=1 warning for csr_load_work_fn() Chris Wilson
  2017-01-18 15:56 ` [PATCH 1/2] drm/i915: Disable -Woverride-init Joonas Lahtinen
  0 siblings, 2 replies; 6+ messages in thread
From: Chris Wilson @ 2017-01-18 12:18 UTC (permalink / raw)
  To: intel-gfx; +Cc: Jani Nikula, Daniel Vetter, Tomi Sarvela

We commonly use an inheritance style approach to device parameters,
where later generations inherit the defaults from earlier generations
and then override settings that change. For example, in i915_pci.c
BDW_FEATURES pulls in HSW_FEATURES, makes a few changes for 48bit
contexts and then individual Broadwell stanzas make further adjustments
for different GT configs.

This causes a lot of warnings with make W=1 from -Woverride-init. We
could use
	#pragma GCC diagnostic push
	#pragma GCC diagnostic ignored "-Woverride-init"
	...
	#pragma GCC diagnostic pop
around the offenders, but the pattern is used frequently enough in the
driver to prefer just disabling the warning entirely.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
---
 drivers/gpu/drm/i915/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 91136b425f77..24cc3c7f814d 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -2,7 +2,8 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-subdir-ccflags-$(CONFIG_DRM_I915_WERROR) := -Werror
+subdir-ccflags-y := -Wno-override-init # used frequently for "inheritance"
+subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
 subdir-ccflags-$(CONFIG_DRM_I915_SELFTEST) += -I$(src) -I$(src)/selftests
 subdir-ccflags-y += \
 	$(call as-instr,movntdqa (%eax)$(comma)%xmm0,-DCONFIG_AS_MOVNTDQA)
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] drm/i915: Fix W=1 warning for csr_load_work_fn()
  2017-01-18 12:18 [PATCH 1/2] drm/i915: Disable -Woverride-init Chris Wilson
@ 2017-01-18 12:18 ` Chris Wilson
  2017-01-18 14:24   ` Mika Kuoppala
  2017-01-18 15:56 ` [PATCH 1/2] drm/i915: Disable -Woverride-init Joonas Lahtinen
  1 sibling, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2017-01-18 12:18 UTC (permalink / raw)
  To: intel-gfx

drivers/gpu/drm/i915/intel_csr.c: In function ‘csr_load_work_fn’:
drivers/gpu/drm/i915/intel_csr.c:399:6: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_csr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
index 0085bc745f6a..9dcc434d3b74 100644
--- a/drivers/gpu/drm/i915/intel_csr.c
+++ b/drivers/gpu/drm/i915/intel_csr.c
@@ -396,13 +396,11 @@ static void csr_load_work_fn(struct work_struct *work)
 	struct drm_i915_private *dev_priv;
 	struct intel_csr *csr;
 	const struct firmware *fw = NULL;
-	int ret;
 
 	dev_priv = container_of(work, typeof(*dev_priv), csr.work);
 	csr = &dev_priv->csr;
 
-	ret = request_firmware(&fw, dev_priv->csr.fw_path,
-			       &dev_priv->drm.pdev->dev);
+	request_firmware(&fw, dev_priv->csr.fw_path, &dev_priv->drm.pdev->dev);
 	if (fw)
 		dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/i915: Fix W=1 warning for csr_load_work_fn()
  2017-01-18 12:18 ` [PATCH 2/2] drm/i915: Fix W=1 warning for csr_load_work_fn() Chris Wilson
@ 2017-01-18 14:24   ` Mika Kuoppala
  0 siblings, 0 replies; 6+ messages in thread
From: Mika Kuoppala @ 2017-01-18 14:24 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

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

> drivers/gpu/drm/i915/intel_csr.c: In function ‘csr_load_work_fn’:
> drivers/gpu/drm/i915/intel_csr.c:399:6: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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

> ---
>  drivers/gpu/drm/i915/intel_csr.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
> index 0085bc745f6a..9dcc434d3b74 100644
> --- a/drivers/gpu/drm/i915/intel_csr.c
> +++ b/drivers/gpu/drm/i915/intel_csr.c
> @@ -396,13 +396,11 @@ static void csr_load_work_fn(struct work_struct *work)
>  	struct drm_i915_private *dev_priv;
>  	struct intel_csr *csr;
>  	const struct firmware *fw = NULL;
> -	int ret;
>  
>  	dev_priv = container_of(work, typeof(*dev_priv), csr.work);
>  	csr = &dev_priv->csr;
>  
> -	ret = request_firmware(&fw, dev_priv->csr.fw_path,
> -			       &dev_priv->drm.pdev->dev);
> +	request_firmware(&fw, dev_priv->csr.fw_path, &dev_priv->drm.pdev->dev);
>  	if (fw)
>  		dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
>  
> -- 
> 2.11.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] drm/i915: Disable -Woverride-init
  2017-01-18 12:18 [PATCH 1/2] drm/i915: Disable -Woverride-init Chris Wilson
  2017-01-18 12:18 ` [PATCH 2/2] drm/i915: Fix W=1 warning for csr_load_work_fn() Chris Wilson
@ 2017-01-18 15:56 ` Joonas Lahtinen
  2017-01-18 16:27   ` Chris Wilson
  1 sibling, 1 reply; 6+ messages in thread
From: Joonas Lahtinen @ 2017-01-18 15:56 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: Jani Nikula, Daniel Vetter, Tomi Sarvela

On ke, 2017-01-18 at 12:18 +0000, Chris Wilson wrote:
> We commonly use an inheritance style approach to device parameters,
> where later generations inherit the defaults from earlier generations
> and then override settings that change. For example, in i915_pci.c
> BDW_FEATURES pulls in HSW_FEATURES, makes a few changes for 48bit
> contexts and then individual Broadwell stanzas make further adjustments
> for different GT configs.
> 
> This causes a lot of warnings with make W=1 from -Woverride-init. We
> could use
> 	#pragma GCC diagnostic push
> 	#pragma GCC diagnostic ignored "-Woverride-init"
> 	...
> 	#pragma GCC diagnostic pop
> around the offenders, but the pattern is used frequently enough in the
> driver to prefer just disabling the warning entirely.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>

<SNIP>
 
> -subdir-ccflags-$(CONFIG_DRM_I915_WERROR) := -Werror
> +subdir-ccflags-y := -Wno-override-init # used frequently for "inheritance"

Why always on, if somebody upper level decides to -Werror, this is
kinda unexpected for them?

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] drm/i915: Disable -Woverride-init
  2017-01-18 15:56 ` [PATCH 1/2] drm/i915: Disable -Woverride-init Joonas Lahtinen
@ 2017-01-18 16:27   ` Chris Wilson
  2017-01-23  8:00     ` Joonas Lahtinen
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2017-01-18 16:27 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: Jani Nikula, Daniel Vetter, intel-gfx, Tomi Sarvela

On Wed, Jan 18, 2017 at 05:56:13PM +0200, Joonas Lahtinen wrote:
> On ke, 2017-01-18 at 12:18 +0000, Chris Wilson wrote:
> > We commonly use an inheritance style approach to device parameters,
> > where later generations inherit the defaults from earlier generations
> > and then override settings that change. For example, in i915_pci.c
> > BDW_FEATURES pulls in HSW_FEATURES, makes a few changes for 48bit
> > contexts and then individual Broadwell stanzas make further adjustments
> > for different GT configs.
> > 
> > This causes a lot of warnings with make W=1 from -Woverride-init. We
> > could use
> > 	#pragma GCC diagnostic push
> > 	#pragma GCC diagnostic ignored "-Woverride-init"
> > 	...
> > 	#pragma GCC diagnostic pop
> > around the offenders, but the pattern is used frequently enough in the
> > driver to prefer just disabling the warning entirely.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com
> > Cc: Jani Nikula <jani.nikula@intel.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
> 
> <SNIP>
>  
> > -subdir-ccflags-$(CONFIG_DRM_I915_WERROR) := -Werror
> > +subdir-ccflags-y := -Wno-override-init # used frequently for "inheritance"
> 
> Why always on, if somebody upper level decides to -Werror, this is
> kinda unexpected for them?

We intentionally use the { .a = 0, .a = 1 }. That is flagged by the set
of warnings enabled by W=1. If the user is using Werror, then they are
faced with an intentionally broken build.

Our choice, if we want to be W=1 clean, is to either markup using #pragma
or turn off the warning.
-Chris

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] drm/i915: Disable -Woverride-init
  2017-01-18 16:27   ` Chris Wilson
@ 2017-01-23  8:00     ` Joonas Lahtinen
  0 siblings, 0 replies; 6+ messages in thread
From: Joonas Lahtinen @ 2017-01-23  8:00 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Jani Nikula, Daniel Vetter, intel-gfx, Tomi Sarvela

On ke, 2017-01-18 at 16:27 +0000, Chris Wilson wrote:
> On Wed, Jan 18, 2017 at 05:56:13PM +0200, Joonas Lahtinen wrote:
> > 
> > On ke, 2017-01-18 at 12:18 +0000, Chris Wilson wrote:
> > >
> > > -subdir-ccflags-$(CONFIG_DRM_I915_WERROR) := -Werror
> > > +subdir-ccflags-y := -Wno-override-init # used frequently for "inheritance"
> > 
> > Why always on, if somebody upper level decides to -Werror, this is
> > kinda unexpected for them?
> 
> We intentionally use the { .a = 0, .a = 1 }. That is flagged by the set
> of warnings enabled by W=1. If the user is using Werror, then they are
> faced with an intentionally broken build.
> 
> Our choice, if we want to be W=1 clean, is to either markup using #pragma
> or turn off the warning.

Guess we can then merge this.

Regards, Joonas

-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-23  8:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-18 12:18 [PATCH 1/2] drm/i915: Disable -Woverride-init Chris Wilson
2017-01-18 12:18 ` [PATCH 2/2] drm/i915: Fix W=1 warning for csr_load_work_fn() Chris Wilson
2017-01-18 14:24   ` Mika Kuoppala
2017-01-18 15:56 ` [PATCH 1/2] drm/i915: Disable -Woverride-init Joonas Lahtinen
2017-01-18 16:27   ` Chris Wilson
2017-01-23  8:00     ` Joonas Lahtinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.