Skip to contentSkip to conversation

ftrace: Format MCOUNT_ADDR address as type unsigned long

PATCH In review Minfei Huang 2 participants 2 messages Jul 12, 2015 – Jul 13, 2015

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

PATCH 1/1 ftrace: Format MCOUNT_ADDR address as type unsigned long

From: Minfei Huang <[email protected]>

Always we use type unsigned long to format the ip address, since the value of ip address is never the negative.

This patch uses type unsigned long, instead of long, to format the ip address. The code is more clearly to be viewed by using type unsigned long, although it is correct by using either unsigned long or long.

---
 arch/metag/include/asm/ftrace.h      | 2 +-
 arch/microblaze/include/asm/ftrace.h | 2 +-
 arch/powerpc/include/asm/ftrace.h    | 2 +-
 arch/sh/include/asm/ftrace.h         | 2 +-
 arch/sparc/include/asm/ftrace.h      | 2 +-
 arch/x86/include/asm/ftrace.h        | 4 ++--
 6 files changed, 7 insertions(+), 7 deletions(-)
arch/metag/include/asm/ftrace.h +1 -1
index 2901f0f..a2269d6 100644
@@ -6,7 +6,7 @@
 
 #ifndef __ASSEMBLY__
 extern void mcount_wrapper(void);
-#define MCOUNT_ADDR		((long)(mcount_wrapper))
+#define MCOUNT_ADDR		((unsigned long)(mcount_wrapper))
 
 static inline unsigned long ftrace_call_adjust(unsigned long addr)
 {
arch/microblaze/include/asm/ftrace.h +1 -1
index fd2fa2ec..da0144f 100644
@@ -3,7 +3,7 @@
 
 #ifdef CONFIG_FUNCTION_TRACER
 
-#define MCOUNT_ADDR		((long)(_mcount))
+#define MCOUNT_ADDR		((unsigned long)(_mcount))
 #define MCOUNT_INSN_SIZE	8 /* sizeof mcount call */
 
 #ifndef __ASSEMBLY__
arch/powerpc/include/asm/ftrace.h +1 -1
index e366187..ef89b14 100644
@@ -2,7 +2,7 @@
 #define _ASM_POWERPC_FTRACE
 
 #ifdef CONFIG_FUNCTION_TRACER
-#define MCOUNT_ADDR		((long)(_mcount))
+#define MCOUNT_ADDR		((unsigned long)(_mcount))
 #define MCOUNT_INSN_SIZE	4 /* sizeof mcount call */
 
 #ifdef __ASSEMBLY__
arch/sh/include/asm/ftrace.h +1 -1
index e79fb6e..1f157b8 100644
@@ -9,7 +9,7 @@
 #ifndef __ASSEMBLY__
 extern void mcount(void);
 
-#define MCOUNT_ADDR		((long)(mcount))
+#define MCOUNT_ADDR		((unsigned long)(mcount))
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 #define CALL_ADDR		((long)(ftrace_call))
arch/sparc/include/asm/ftrace.h +1 -1
index 9ec94ad..3192a8e 100644
@@ -2,7 +2,7 @@
 #define _ASM_SPARC64_FTRACE
 
 #ifdef CONFIG_MCOUNT
-#define MCOUNT_ADDR		((long)(_mcount))
+#define MCOUNT_ADDR		((unsigned long)(_mcount))
 #define MCOUNT_INSN_SIZE	4 /* sizeof mcount call */
 
 #ifndef __ASSEMBLY__
arch/x86/include/asm/ftrace.h +2 -2
index f45acad..2493885 100644
@@ -3,9 +3,9 @@
 
 #ifdef CONFIG_FUNCTION_TRACER
 #ifdef CC_USING_FENTRY
-# define MCOUNT_ADDR		((long)(__fentry__))
+# define MCOUNT_ADDR		((unsigned long)(__fentry__))
 #else
-# define MCOUNT_ADDR		((long)(mcount))
+# define MCOUNT_ADDR		((unsigned long)(mcount))
 #endif
 #define MCOUNT_INSN_SIZE	5 /* sizeof mcount call */
 
Signature · 1 line
2.2.2
maintainer
#1 lore raw
Quoted 9 lines · On Sun, 12 Jul 2015 17:52:24 +0800 Minfei Huang <[email protected]> wrote:

From: Minfei Huang <[email protected]>

Always we use type unsigned long to format the ip address, since the value of ip address is never the negative.

This patch uses type unsigned long, instead of long, to format the ip address. The code is more clearly to be viewed by using type unsigned long, although it is correct by using either unsigned long or long.

The only place MCOUNT_ADDR is used in generic code is being passed into a parameter that is already typed "unsigned long". But I'm fine with the patch just to make it consistent. I added the appropriate Cc's for this patch too.

-- Steve

Quoted 91 lines
---
 arch/metag/include/asm/ftrace.h      | 2 +-
 arch/microblaze/include/asm/ftrace.h | 2 +-
 arch/powerpc/include/asm/ftrace.h    | 2 +-
 arch/sh/include/asm/ftrace.h         | 2 +-
 arch/sparc/include/asm/ftrace.h      | 2 +-
 arch/x86/include/asm/ftrace.h        | 4 ++--
 6 files changed, 7 insertions(+), 7 deletions(-)
arch/metag/include/asm/ftrace.h +1 -1
index 2901f0f..a2269d6 100644
@@ -6,7 +6,7 @@
 
 #ifndef __ASSEMBLY__
 extern void mcount_wrapper(void);
-#define MCOUNT_ADDR		((long)(mcount_wrapper))
+#define MCOUNT_ADDR		((unsigned long)(mcount_wrapper))
 
 static inline unsigned long ftrace_call_adjust(unsigned long addr)
 {
arch/microblaze/include/asm/ftrace.h +1 -1
index fd2fa2ec..da0144f 100644
@@ -3,7 +3,7 @@
 
 #ifdef CONFIG_FUNCTION_TRACER
 
-#define MCOUNT_ADDR		((long)(_mcount))
+#define MCOUNT_ADDR		((unsigned long)(_mcount))
 #define MCOUNT_INSN_SIZE	8 /* sizeof mcount call */
 
 #ifndef __ASSEMBLY__
arch/powerpc/include/asm/ftrace.h +1 -1
index e366187..ef89b14 100644
@@ -2,7 +2,7 @@
 #define _ASM_POWERPC_FTRACE
 
 #ifdef CONFIG_FUNCTION_TRACER
-#define MCOUNT_ADDR		((long)(_mcount))
+#define MCOUNT_ADDR		((unsigned long)(_mcount))
 #define MCOUNT_INSN_SIZE	4 /* sizeof mcount call */
 
 #ifdef __ASSEMBLY__
arch/sh/include/asm/ftrace.h +1 -1
index e79fb6e..1f157b8 100644
@@ -9,7 +9,7 @@
 #ifndef __ASSEMBLY__
 extern void mcount(void);
 
-#define MCOUNT_ADDR		((long)(mcount))
+#define MCOUNT_ADDR		((unsigned long)(mcount))
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 #define CALL_ADDR		((long)(ftrace_call))
arch/sparc/include/asm/ftrace.h +1 -1
index 9ec94ad..3192a8e 100644
@@ -2,7 +2,7 @@
 #define _ASM_SPARC64_FTRACE
 
 #ifdef CONFIG_MCOUNT
-#define MCOUNT_ADDR		((long)(_mcount))
+#define MCOUNT_ADDR		((unsigned long)(_mcount))
 #define MCOUNT_INSN_SIZE	4 /* sizeof mcount call */
 
 #ifndef __ASSEMBLY__
arch/x86/include/asm/ftrace.h +2 -2
index f45acad..2493885 100644
@@ -3,9 +3,9 @@
 
 #ifdef CONFIG_FUNCTION_TRACER
 #ifdef CC_USING_FENTRY
-# define MCOUNT_ADDR		((long)(__fentry__))
+# define MCOUNT_ADDR		((unsigned long)(__fentry__))
 #else
-# define MCOUNT_ADDR		((long)(mcount))
+# define MCOUNT_ADDR		((unsigned long)(mcount))
 #endif
 #define MCOUNT_INSN_SIZE	5 /* sizeof mcount call */