[PATCH] powerpc: powernv: Fix build error on const discarding

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3324d

6 messages, 4 authors, 2017-08-31 · open the first message on its own page

[PATCH] powerpc: powernv: Fix build error on const discarding

From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: 2017-08-16 12:36:59

When building a random powerpc kernel I hit this build error:
  CC      arch/powerpc/platforms/powernv/opal-imc.o
arch/powerpc/platforms/powernv/opal-imc.c: In function « disable_nest_pmu_counters »:
arch/powerpc/platforms/powernv/opal-imc.c:130:13: error : assignment discards « const » qualifier from pointer target type [-Werror=discarded-qualifiers]
   l_cpumask = cpumask_of_node(nid);
             ^
This patch simply add const to l_cpumask to fix this issue.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 arch/powerpc/platforms/powernv/opal-imc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c
index b903bf5e6006..21f6531fae20 100644
--- a/arch/powerpc/platforms/powernv/opal-imc.c
+++ b/arch/powerpc/platforms/powernv/opal-imc.c
@@ -123,7 +123,7 @@ static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain)
 static void disable_nest_pmu_counters(void)
 {
 	int nid, cpu;
-	struct cpumask *l_cpumask;
+	const struct cpumask *l_cpumask;
 
 	get_online_cpus();
 	for_each_online_node(nid) {
-- 
2.13.0

Re: [PATCH] powerpc: powernv: Fix build error on const discarding

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2017-08-17 12:52:19

Corentin Labbe [off-list ref] writes:
When building a random powerpc kernel I hit this build error:
  CC      arch/powerpc/platforms/powernv/opal-imc.o
arch/powerpc/platforms/powernv/opal-imc.c: In function =C2=AB=C2=A0disabl=
e_nest_pmu_counters=C2=A0=C2=BB:
arch/powerpc/platforms/powernv/opal-imc.c:130:13: error=C2=A0: assignment=
 discards =C2=AB=C2=A0const=C2=A0=C2=BB qualifier from pointer target type =
[-Werror=3Ddiscarded-qualifiers]
   l_cpumask =3D cpumask_of_node(nid);
             ^
This patch simply add const to l_cpumask to fix this issue.
Thanks. I'm not sure why we haven't seen that.

Do you mind attaching your .config ?

cheers

Re: [PATCH] powerpc: powernv: Fix build error on const discarding

From: Madhavan Srinivasan <hidden>
Date: 2017-08-17 14:05:44


On Wednesday 16 August 2017 06:04 PM, Corentin Labbe wrote:
When building a random powerpc kernel I hit this build error:
   CC      arch/powerpc/platforms/powernv/opal-imc.o
arch/powerpc/platforms/powernv/opal-imc.c: In function « disable_nest_pmu_counters »:
arch/powerpc/platforms/powernv/opal-imc.c:130:13: error : assignment discards « const » qualifier from pointer target type [-Werror=discarded-qualifiers]
    l_cpumask = cpumask_of_node(nid);
              ^
This patch simply add const to l_cpumask to fix this issue.
Reviewed-by: Madhavan Srinivasan <redacted>
quoted hunk
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
  arch/powerpc/platforms/powernv/opal-imc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c
index b903bf5e6006..21f6531fae20 100644
--- a/arch/powerpc/platforms/powernv/opal-imc.c
+++ b/arch/powerpc/platforms/powernv/opal-imc.c
@@ -123,7 +123,7 @@ static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain)
  static void disable_nest_pmu_counters(void)
  {
  	int nid, cpu;
-	struct cpumask *l_cpumask;
+	const struct cpumask *l_cpumask;

  	get_online_cpus();
  	for_each_online_node(nid) {

Re: [PATCH] powerpc: powernv: Fix build error on const discarding

From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: 2017-08-18 12:58:28

On Thu, Aug 17, 2017 at 10:52:11PM +1000, Michael Ellerman wrote:
Corentin Labbe [off-list ref] writes:
quoted
When building a random powerpc kernel I hit this build error:
  CC      arch/powerpc/platforms/powernv/opal-imc.o
arch/powerpc/platforms/powernv/opal-imc.c: In function « disable_nest_pmu_counters »:
arch/powerpc/platforms/powernv/opal-imc.c:130:13: error : assignment discards « const » qualifier from pointer target type [-Werror=discarded-qualifiers]
   l_cpumask = cpumask_of_node(nid);
             ^
This patch simply add const to l_cpumask to fix this issue.
Thanks. I'm not sure why we haven't seen that.

Do you mind attaching your .config ?

cheers
Yes

Regards

Re: [PATCH] powerpc: powernv: Fix build error on const discarding

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2017-08-25 01:26:39

Corentin Labbe [off-list ref] writes:
On Thu, Aug 17, 2017 at 10:52:11PM +1000, Michael Ellerman wrote:
quoted
Corentin Labbe [off-list ref] writes:
=20
quoted
When building a random powerpc kernel I hit this build error:
  CC      arch/powerpc/platforms/powernv/opal-imc.o
arch/powerpc/platforms/powernv/opal-imc.c: In function =C2=AB=C2=A0dis=
able_nest_pmu_counters=C2=A0=C2=BB:
quoted
quoted
arch/powerpc/platforms/powernv/opal-imc.c:130:13: error=C2=A0: assignm=
ent discards =C2=AB=C2=A0const=C2=A0=C2=BB qualifier from pointer target ty=
pe [-Werror=3Ddiscarded-qualifiers]
quoted
quoted
   l_cpumask =3D cpumask_of_node(nid);
             ^
This patch simply add const to l_cpumask to fix this issue.
=20
Thanks. I'm not sure why we haven't seen that.
=20
Do you mind attaching your .config ?
=20
cheers
Yes
Thanks.

So the key is:
CONFIG_PPC_POWERNV=3Dy
...
# CONFIG_NUMA is not set

Which none of our configs have.

I'll add a test build of that.

Thanks.

cheers

Re: powerpc: powernv: Fix build error on const discarding

From: Michael Ellerman <hidden>
Date: 2017-08-31 11:36:17

On Wed, 2017-08-16 at 12:34:44 UTC, Corentin Labbe wrote:
When building a random powerpc kernel I hit this build error:
  CC      arch/powerpc/platforms/powernv/opal-imc.o
arch/powerpc/platforms/powernv/opal-imc.c: In function ����disable_nest_pmu_counters����:
arch/powerpc/platforms/powernv/opal-imc.c:130:13: error��: assignment discards ����const���� qualifier from pointer target type [-Werror=discarded-qualifiers]
   l_cpumask = cpumask_of_node(nid);
             ^
This patch simply add const to l_cpumask to fix this issue.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Reviewed-by: Madhavan Srinivasan <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/6538ac30841638b2fd345725a9fd15

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help