linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i915: fix build on gcc7
@ 2017-06-01 11:40 Aleksa Sarai
  2017-06-01 11:53 ` Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Aleksa Sarai @ 2017-06-01 11:40 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, David Airlie
  Cc: intel-gfx, dri-devel, linux-kernel, Aleksa Sarai

With gcc7, the conditional usage of (port == PORT_A ? PORT_C : PORT_A)
triggers -Werror=int-in-bool-context which breaks the build. Instead,
use a temporary port_other variable that avoids hitting this error.

  % gcc --version
  gcc (SUSE Linux) 7.1.1 20170517 [gcc-7-branch revision 248152]
  Copyright (C) 2017 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  % make -j8 drivers/gpu/drm/i915/intel_dsi.o
  In file included from drivers/gpu/drm/i915/intel_dsi.c:34:0:
  drivers/gpu/drm/i915/intel_dsi.c: In function ‘intel_dsi_prepare’:
  drivers/gpu/drm/i915/intel_dsi.c:1487:23: error: ?: using integer constants in boolean context [-Werror=int-in-bool-context]
         PORT_A ? PORT_C : PORT_A),
  drivers/gpu/drm/i915/i915_drv.h:3909:76: note: in definition of macro ‘I915_WRITE’
   #define I915_WRITE(reg, val) dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), true)
                                                                              ^~~
  drivers/gpu/drm/i915/i915_reg.h:8280:32: note: in expansion of macro ‘_MMIO’
   #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
                                  ^~~~~
  drivers/gpu/drm/i915/i915_reg.h:8280:38: note: in expansion of macro ‘_MIPI_PORT’
   #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
                                        ^~~~~~~~~~
  drivers/gpu/drm/i915/i915_reg.h:8624:32: note: in expansion of macro ‘_MMIO_MIPI’
   #define MIPI_INIT_COUNT(port)  _MMIO_MIPI(port, _MIPIA_INIT_COUNT, _MIPIC_INIT_COUNT)
                                  ^~~~~~~~~~
  drivers/gpu/drm/i915/intel_dsi.c:1486:15: note: in expansion of macro ‘MIPI_INIT_COUNT’
      I915_WRITE(MIPI_INIT_COUNT(port ==
                 ^~~~~~~~~~~~~~~

Signed-off-by: Aleksa Sarai <asarai@suse.de>
---
 drivers/gpu/drm/i915/intel_dsi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 54030b68406a..53e717e7b811 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1476,14 +1476,15 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder,
 				txclkesc(intel_dsi->escape_clk_div, 100));
 
 		if (IS_GEN9_LP(dev_priv) && (!intel_dsi->dual_link)) {
+			enum port port_other = port == PORT_A ? PORT_C : PORT_A;
+
 			/*
 			 * BXT spec says write MIPI_INIT_COUNT for
 			 * both the ports, even if only one is
 			 * getting used. So write the other port
 			 * if not in dual link mode.
 			 */
-			I915_WRITE(MIPI_INIT_COUNT(port ==
-						PORT_A ? PORT_C : PORT_A),
+			I915_WRITE(MIPI_INIT_COUNT(port_other),
 					intel_dsi->init_count);
 		}
 
-- 
2.13.0

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

* Re: [PATCH] i915: fix build on gcc7
  2017-06-01 11:40 [PATCH] i915: fix build on gcc7 Aleksa Sarai
@ 2017-06-01 11:53 ` Jani Nikula
  2017-06-01 12:08   ` Aleksa Sarai
  0 siblings, 1 reply; 3+ messages in thread
From: Jani Nikula @ 2017-06-01 11:53 UTC (permalink / raw)
  To: Aleksa Sarai, Daniel Vetter, David Airlie
  Cc: intel-gfx, dri-devel, linux-kernel, Aleksa Sarai

On Thu, 01 Jun 2017, Aleksa Sarai <asarai@suse.de> wrote:
> With gcc7, the conditional usage of (port == PORT_A ? PORT_C : PORT_A)
> triggers -Werror=int-in-bool-context which breaks the build. Instead,
> use a temporary port_other variable that avoids hitting this error.
>
>   % gcc --version
>   gcc (SUSE Linux) 7.1.1 20170517 [gcc-7-branch revision 248152]
>   Copyright (C) 2017 Free Software Foundation, Inc.
>   This is free software; see the source for copying conditions.  There is NO
>   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>   % make -j8 drivers/gpu/drm/i915/intel_dsi.o
>   In file included from drivers/gpu/drm/i915/intel_dsi.c:34:0:
>   drivers/gpu/drm/i915/intel_dsi.c: In function ‘intel_dsi_prepare’:
>   drivers/gpu/drm/i915/intel_dsi.c:1487:23: error: ?: using integer constants in boolean context [-Werror=int-in-bool-context]
>          PORT_A ? PORT_C : PORT_A),
>   drivers/gpu/drm/i915/i915_drv.h:3909:76: note: in definition of macro ‘I915_WRITE’
>    #define I915_WRITE(reg, val) dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), true)
>                                                                               ^~~
>   drivers/gpu/drm/i915/i915_reg.h:8280:32: note: in expansion of macro ‘_MMIO’
>    #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
>                                   ^~~~~
>   drivers/gpu/drm/i915/i915_reg.h:8280:38: note: in expansion of macro ‘_MIPI_PORT’
>    #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
>                                         ^~~~~~~~~~
>   drivers/gpu/drm/i915/i915_reg.h:8624:32: note: in expansion of macro ‘_MMIO_MIPI’
>    #define MIPI_INIT_COUNT(port)  _MMIO_MIPI(port, _MIPIA_INIT_COUNT, _MIPIC_INIT_COUNT)
>                                   ^~~~~~~~~~
>   drivers/gpu/drm/i915/intel_dsi.c:1486:15: note: in expansion of macro ‘MIPI_INIT_COUNT’
>       I915_WRITE(MIPI_INIT_COUNT(port ==
>                  ^~~~~~~~~~~~~~~
>
> Signed-off-by: Aleksa Sarai <asarai@suse.de>

This is probably already fixed in drm-next by

commit 0ad4dc887d4168448e8c801aa4edd8fe1e0bd534
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Thu May 18 13:06:44 2017 +0200

    drm/i915: Fix new -Wint-in-bool-context gcc compiler warning

which I also think is a more sensible fix than this one.

BR,
Jani.


> ---
>  drivers/gpu/drm/i915/intel_dsi.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 54030b68406a..53e717e7b811 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -1476,14 +1476,15 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder,
>  				txclkesc(intel_dsi->escape_clk_div, 100));
>  
>  		if (IS_GEN9_LP(dev_priv) && (!intel_dsi->dual_link)) {
> +			enum port port_other = port == PORT_A ? PORT_C : PORT_A;
> +
>  			/*
>  			 * BXT spec says write MIPI_INIT_COUNT for
>  			 * both the ports, even if only one is
>  			 * getting used. So write the other port
>  			 * if not in dual link mode.
>  			 */
> -			I915_WRITE(MIPI_INIT_COUNT(port ==
> -						PORT_A ? PORT_C : PORT_A),
> +			I915_WRITE(MIPI_INIT_COUNT(port_other),
>  					intel_dsi->init_count);
>  		}

-- 
Jani Nikula, Intel Open Source Technology Center

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

* Re: [PATCH] i915: fix build on gcc7
  2017-06-01 11:53 ` Jani Nikula
@ 2017-06-01 12:08   ` Aleksa Sarai
  0 siblings, 0 replies; 3+ messages in thread
From: Aleksa Sarai @ 2017-06-01 12:08 UTC (permalink / raw)
  To: Jani Nikula, Daniel Vetter, David Airlie
  Cc: intel-gfx, dri-devel, linux-kernel


> This is probably already fixed in drm-next by
> 
> commit 0ad4dc887d4168448e8c801aa4edd8fe1e0bd534
> Author: Hans de Goede <hdegoede@redhat.com>
> Date:   Thu May 18 13:06:44 2017 +0200
> 
>      drm/i915: Fix new -Wint-in-bool-context gcc compiler warning
> > which I also think is a more sensible fix than this one.

Ah, I didn't see that patch. Yeah, you're right.

-- 
Aleksa Sarai
Software Engineer (Containers)
SUSE Linux GmbH
https://www.cyphar.com/

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

end of thread, other threads:[~2017-06-01 12:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-01 11:40 [PATCH] i915: fix build on gcc7 Aleksa Sarai
2017-06-01 11:53 ` Jani Nikula
2017-06-01 12:08   ` Aleksa Sarai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).