Skip to contentSkip to conversation

h8300: IRQ flags should be stored in an unsigned long

PATCH New David Howells 1 participant 3 messages Aug 26, 2010 Atomic infrastructure

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 h8300: IRQ flags should be stored in an unsigned long

Fix h8300's asm/atomic.h to store the IRQ flags in an unsigned long to deal with warnings of the following type:

/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/atomic.h: In function 'atomic_add_return':
/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/atomic.h:22: warning: comparison of distinct pointer types lacks a cast /warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/atomic.h:24: warning: comparison of distinct pointer types lacks a cast

---

 arch/h8300/include/asm/atomic.h |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
arch/h8300/include/asm/atomic.h +10 -5
index e936804..984221a 100644
@@ -18,7 +18,8 @@
 
 static __inline__ int atomic_add_return(int i, atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 	local_irq_save(flags);
 	ret = v->counter += i;
 	local_irq_restore(flags);
@@ -30,7 +31,8 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
 
 static __inline__ int atomic_sub_return(int i, atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 	local_irq_save(flags);
 	ret = v->counter -= i;
 	local_irq_restore(flags);
@@ -42,7 +44,8 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
 
 static __inline__ int atomic_inc_return(atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 	local_irq_save(flags);
 	v->counter++;
 	ret = v->counter;
@@ -64,7 +67,8 @@ static __inline__ int atomic_inc_return(atomic_t *v)
 
 static __inline__ int atomic_dec_return(atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 	local_irq_save(flags);
 	--v->counter;
 	ret = v->counter;
@@ -76,7 +80,8 @@ static __inline__ int atomic_dec_return(atomic_t *v)
 
 static __inline__ int atomic_dec_and_test(atomic_t *v)
 {
-	int ret,flags;
+	unsigned long flags;
+	int ret;
 	local_irq_save(flags);
 	--v->counter;
 	ret = v->counter;
#1 lore raw

PATCH 2/3 h8300: Fix die()

Fix h8300's die() to take care of a number of problems:

CC arch/h8300/kernel/traps.o
In file included from /warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/bitops.h:10,

                 from include/linux/bitops.h:22,
                 from include/linux/kernel.h:17,
                 from include/linux/sched.h:54,
                 from arch/h8300/kernel/traps.c:18:

/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/system.h:136: warning: 'struct pt_regs' declared inside parameter list /warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/system.h:136: warning: its scope is only this definition or declaration, which is probably not what you want arch/h8300/kernel/traps.c:100: error: conflicting types for 'die'
/warthog/nfs/linux-2.6-fscache/arch/h8300/include/asm/system.h:136: error: previous declaration of 'die' was here
make[2]: *** [arch/h8300/kernel/traps.o] Error 1

---

 arch/h8300/include/asm/system.h |    4 +++-
 arch/h8300/kernel/traps.c       |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/h8300/include/asm/system.h +3 -1
index d98d976..16bf156 100644
@@ -3,6 +3,8 @@
 
 #include <linux/linkage.h>
 
+struct pt_regs;
+
 /*
  * switch_to(n) should switch tasks to task ptr, first checking that
  * ptr isn't the current task, in which case it does nothing.  This
@@ -155,6 +157,6 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
 
 #define arch_align_stack(x) (x)
 
-void die(char *str, struct pt_regs *fp, unsigned long err);
+extern void die(const char *str, struct pt_regs *fp, unsigned long err);
 
 #endif /* _H8300_SYSTEM_H */
arch/h8300/kernel/traps.c +1 -1
index 3c0b66b..dfa05bd 100644
@@ -96,7 +96,7 @@ static void dump(struct pt_regs *fp)
 	printk("\n\n");
 }
 
-void die(char *str, struct pt_regs *fp, unsigned long err)
+void die(const char *str, struct pt_regs *fp, unsigned long err)
 {
 	static int diecount;
 
#2 lore raw

PATCH 3/3 h8300: Fix missing consts in kernel_execve()

In reply to David Howells

Fix missing consts in h8300's kernel_execve():

arch/h8300/kernel/sys_h8300.c: In function 'kernel_execve':
arch/h8300/kernel/sys_h8300.c:59: warning: initialization from incompatible pointer type arch/h8300/kernel/sys_h8300.c:60: warning: initialization from incompatible pointer type

---

 arch/h8300/kernel/sys_h8300.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/h8300/kernel/sys_h8300.c +2 -2
index dc1ac02..aaf5e5a 100644
@@ -56,8 +56,8 @@ int kernel_execve(const char *filename,
 		  const char *const envp[])
 {
 	register long res __asm__("er0");
-	register char *const *_c __asm__("er3") = envp;
-	register char *const *_b __asm__("er2") = argv;
+	register const char *const *_c __asm__("er3") = envp;
+	register const char *const *_b __asm__("er2") = argv;
 	register const char * _a __asm__("er1") = filename;
 	__asm__ __volatile__ ("mov.l %1,er0\n\t"
 			"trapa	#0\n\t"