Skip to contentSkip to conversation

fix compile warnings in plat-iop/cp6.c

PATCH New Mikael Pettersson 2 participants 5 messages Jul 22, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix compile warnings in plat-iop/cp6.c

Building 3.0 for an n2100 (plat-iop) results in:

In file included from arch/arm/plat-iop/cp6.c:20:
/tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: its scope is only this definition or declaration, which is probably not what you want /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct task_struct' declared inside parameter list arch/arm/plat-iop/cp6.c:45: warning: initialization from incompatible pointer type

The pt_regs and incompatible pointer type warnings are fixed by including <asm/ptrace.h> before <asm/traps.h>. Nothing here depends on task_struct, so that warning can be fixed by a forward struct declaration.

---

arch/arm/plat-iop/cp6.c renamed from arch/arm/plat-iop/cp6.c.~1~ +2 -1
@@ -17,8 +17,9 @@
  *
  */
 #include <linux/init.h>
-#include <asm/traps.h>
 #include <asm/ptrace.h>
+struct task_struct;
+#include <asm/traps.h>
 
 static int cp6_trap(struct pt_regs *regs, unsigned int instr)
 {
#1 lore raw

PATCH 1/1 fix compile warnings in plat-iop/cp6.c

Quoted 9 lines · Mikael Pettersson

Building 3.0 for an n2100 (plat-iop) results in:

In file included from arch/arm/plat-iop/cp6.c:20:
/tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: its scope is only this definition or declaration, which is probably not what you want /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct task_struct' declared inside parameter list arch/arm/plat-iop/cp6.c:45: warning: initialization from incompatible pointer type

Quoted 3 lines

The pt_regs and incompatible pointer type warnings are fixed by including <asm/ptrace.h> before <asm/traps.h>. Nothing here depends on task_struct, so that warning can be fixed by a forward struct declaration.

Why not add a forward declaration of struct pt_regs and task_struct to asm/traps.h ?

#2 lore raw

PATCH 1/1 fix compile warnings in plat-iop/cp6.c

Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Mikael Pettersson

Building 3.0 for an n2100 (plat-iop) results in:

In file included from arch/arm/plat-iop/cp6.c:20:
/tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: its scope is only this definition or declaration, which is probably not what you want /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct task_struct' declared inside parameter list arch/arm/plat-iop/cp6.c:45: warning: initialization from incompatible pointer type

Quoted 6 lines
Quoted 3 lines

The pt_regs and incompatible pointer type warnings are fixed by including <asm/ptrace.h> before <asm/traps.h>. Nothing here depends on task_struct, so that warning can be fixed by a forward struct declaration.

Why not add a forward declaration of struct pt_regs and task_struct to asm/traps.h ?

Sure, that works too. Revised patch below. Only tested on n2100 so far.

Building kernel 3.0 for an n2100 (plat-iop) results in:

In file included from arch/arm/plat-iop/cp6.c:20:
/tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: its scope is only this definition or declaration, which is probably not what you want /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct task_struct' declared inside parameter list arch/arm/plat-iop/cp6.c:45: warning: initialization from incompatible pointer type

Nothing here depends on the layout of pt_regs or task_struct, so this can be fixed by adding forward struct declarations to asm/traps.h.

---

arch/arm/include/asm/traps.h renamed from arch/arm/include/asm/traps.h.~1~ +3 -0
@@ -3,6 +3,9 @@
 
 #include <linux/list.h>
 
+struct pt_regs;
+struct task_struct;
+
 struct undef_hook {
 	struct list_head node;
 	u32 instr_mask;
#3 lore raw

PATCH 1/1 fix compile warnings in plat-iop/cp6.c

Quoted 1 line · Mikael Pettersson

Sure, that works too. Revised patch below. Only tested on n2100 so far.

Do you know when this started to go wrong - do we need to copy it to some stable trees?

Other than that, looks fine, so -> patch system please.

Thanks.

Quoted 32 lines

Building kernel 3.0 for an n2100 (plat-iop) results in:

In file included from arch/arm/plat-iop/cp6.c:20:
/tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: its scope is only this definition or declaration, which is probably not what you want /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct task_struct' declared inside parameter list arch/arm/plat-iop/cp6.c:45: warning: initialization from incompatible pointer type

Nothing here depends on the layout of pt_regs or task_struct, so this can be fixed by adding forward struct declarations to asm/traps.h.

---

arch/arm/include/asm/traps.h renamed from arch/arm/include/asm/traps.h.~1~ +3 -0
@@ -3,6 +3,9 @@
 
 #include <linux/list.h>
 
+struct pt_regs;
+struct task_struct;
+
 struct undef_hook {
 	struct list_head node;
 	u32 instr_mask;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

PATCH 1/1 fix compile warnings in plat-iop/cp6.c

Quoted 5 lines · Russell King - ARM Linux
Quoted 1 line · Mikael Pettersson

Sure, that works too. Revised patch below. Only tested on n2100 so far.

Do you know when this started to go wrong - do we need to copy it to some stable trees?

2.6.39 doesn't have this problem so backporting shouldn't be necessary.

Quoted 1 line

Other than that, looks fine, so -> patch system please.

Done, it's now "7004/1 fix traps.h compile warnings".

Thanks.

Quoted 36 lines

Thanks.

Quoted 32 lines

Building kernel 3.0 for an n2100 (plat-iop) results in:

In file included from arch/arm/plat-iop/cp6.c:20:
/tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:12: warning: its scope is only this definition or declaration, which is probably not what you want /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct pt_regs' declared inside parameter list /tmp/linux-3.0/arch/arm/include/asm/traps.h:48: warning: 'struct task_struct' declared inside parameter list arch/arm/plat-iop/cp6.c:45: warning: initialization from incompatible pointer type

Nothing here depends on the layout of pt_regs or task_struct, so this can be fixed by adding forward struct declarations to asm/traps.h.

---

arch/arm/include/asm/traps.h renamed from arch/arm/include/asm/traps.h.~1~ +3 -0
@@ -3,6 +3,9 @@
 
 #include <linux/list.h>
 
+struct pt_regs;
+struct task_struct;
+
 struct undef_hook {
 	struct list_head node;
 	u32 instr_mask;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel