#define _ASM_ARM_FTRACE
#ifndef __ASSEMBLY__
-#define ftrace_nmi_enter() do { } while (0)
-#define ftrace_nmi_exit() do { } while (0)
+static inline void ftrace_nmi_enter(void) { }
+static inline void ftrace_nmi_exit(void) { }
#endif
#ifdef CONFIG_FUNCTION_TRACER
#define _ASM_POWERPC_FTRACE
#ifndef __ASSEMBLY__
-#define ftrace_nmi_enter() do { } while (0)
-#define ftrace_nmi_exit() do { } while (0)
+static inline void ftrace_nmi_enter(void) { }
+static inline void ftrace_nmi_exit(void) { }
#endif
#ifdef CONFIG_FUNCTION_TRACER
#define __ASM_SH_FTRACE_H
#ifndef __ASSEMBLY__
-#define ftrace_nmi_enter() do { } while (0)
-#define ftrace_nmi_exit() do { } while (0)
+static inline void ftrace_nmi_enter(void) { }
+static inline void ftrace_nmi_exit(void) { }
#endif
#ifndef __ASSEMBLY__
#define _ASM_SPARC64_FTRACE
#ifndef __ASSEMBLY__
-#define ftrace_nmi_enter() do { } while (0)
-#define ftrace_nmi_exit() do { } while (0)
+static inline void ftrace_nmi_enter(void) { }
+static inline void ftrace_nmi_exit(void) { }
#endif
#ifdef CONFIG_MCOUNT
extern void ftrace_nmi_enter(void);
extern void ftrace_nmi_exit(void);
#else
-#define ftrace_nmi_enter() do { } while (0)
-#define ftrace_nmi_exit() do { } while (0)
-#endif
+static inline void ftrace_nmi_enter(void) { }
+static inline void ftrace_nmi_exit(void) { }
#endif
+#endif /* __ASSEMBLY__ */
#else /* CONFIG_FUNCTION_TRACER */
#ifndef __ASSEMBLY__
-#define ftrace_nmi_enter() do { } while (0)
-#define ftrace_nmi_exit() do { } while (0)
+static inline void ftrace_nmi_enter(void) { }
+static inline void ftrace_nmi_exit(void) { }
#endif
#endif /* CONFIG_FUNCTION_TRACER */
*
* Two buffers are added: An IP buffer and a "code" buffer.
*
- * 1) Put in the instruction pointer into the IP buffer
+ * 1) Put the instruction pointer into the IP buffer
* and the new code into the "code" buffer.
* 2) Set a flag that says we are modifying code
* 3) Wait for any running NMIs to finish.
* are the same as what exists.
*/
-static atomic_t in_nmi;
-static int mod_code_status;
-static int mod_code_write;
-static void *mod_code_ip;
-static void *mod_code_newcode;
+static atomic_t in_nmi = ATOMIC_INIT(0);
+static int mod_code_status; /* holds return value of text write */
+static int mod_code_write; /* set when NMI should do the write */
+static void *mod_code_ip; /* holds the IP to write to */
+static void *mod_code_newcode; /* holds the text to write to the IP */
-static int nmi_wait_count;
-static atomic_t nmi_update_count;
+static unsigned nmi_wait_count;
+static atomic_t nmi_update_count = ATOMIC_INIT(0);
int ftrace_arch_read_dyn_info(char *buf, int size)
{
extern void ftrace_call(void);
extern void mcount_call(void);
+/* May be defined in arch */
+extern int ftrace_arch_read_dyn_info(char *buf, int size);
+
/**
* ftrace_modify_code - modify code segment
* @ip: the address of the code segment
#ifdef CONFIG_DYNAMIC_FTRACE
-#define DYN_INFO_BUF_SIZE 1023
-static char ftrace_dyn_info_buffer[DYN_INFO_BUF_SIZE+1];
-static DEFINE_MUTEX(dyn_info_mutex);
-
int __weak ftrace_arch_read_dyn_info(char *buf, int size)
{
return 0;
tracing_read_dyn_info(struct file *filp, char __user *ubuf,
size_t cnt, loff_t *ppos)
{
+ static char ftrace_dyn_info_buffer[1024];
+ static DEFINE_MUTEX(dyn_info_mutex);
unsigned long *p = filp->private_data;
char *buf = ftrace_dyn_info_buffer;
+ int size = ARRAY_SIZE(ftrace_dyn_info_buffer);
int r;
mutex_lock(&dyn_info_mutex);
r = sprintf(buf, "%ld ", *p);
- r += ftrace_arch_read_dyn_info(buf+r, DYN_INFO_BUF_SIZE-r);
+ r += ftrace_arch_read_dyn_info(buf+r, (size-1)-r);
buf[r++] = '\n';
r = simple_read_from_buffer(ubuf, cnt, ppos, buf, r);