aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bat_debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/bat_debugfs.c')
-rw-r--r--net/batman-adv/bat_debugfs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index abaeec5f624..d0af9bf69e4 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -50,7 +50,8 @@ static void emit_log_char(struct debug_log *debug_log, char c)
50 debug_log->log_start = debug_log->log_end - log_buff_len; 50 debug_log->log_start = debug_log->log_end - log_buff_len;
51} 51}
52 52
53static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) 53__printf(2, 3)
54static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...)
54{ 55{
55 va_list args; 56 va_list args;
56 static char debug_log_buf[256]; 57 static char debug_log_buf[256];
@@ -74,14 +75,14 @@ static int fdebug_log(struct debug_log *debug_log, char *fmt, ...)
74 return 0; 75 return 0;
75} 76}
76 77
77int debug_log(struct bat_priv *bat_priv, char *fmt, ...) 78int debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
78{ 79{
79 va_list args; 80 va_list args;
80 char tmp_log_buf[256]; 81 char tmp_log_buf[256];
81 82
82 va_start(args, fmt); 83 va_start(args, fmt);
83 vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); 84 vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args);
84 fdebug_log(bat_priv->debug_log, "[%10u] %s", 85 fdebug_log(bat_priv->debug_log, "[%10lu] %s",
85 (jiffies / HZ), tmp_log_buf); 86 (jiffies / HZ), tmp_log_buf);
86 va_end(args); 87 va_end(args);
87 88
@@ -114,7 +115,7 @@ static ssize_t log_read(struct file *file, char __user *buf,
114 !(debug_log->log_end - debug_log->log_start)) 115 !(debug_log->log_end - debug_log->log_start))
115 return -EAGAIN; 116 return -EAGAIN;
116 117
117 if ((!buf) || (count < 0)) 118 if (!buf)
118 return -EINVAL; 119 return -EINVAL;
119 120
120 if (count == 0) 121 if (count == 0)
@@ -184,7 +185,7 @@ static int debug_log_setup(struct bat_priv *bat_priv)
184 if (!bat_priv->debug_dir) 185 if (!bat_priv->debug_dir)
185 goto err; 186 goto err;
186 187
187 bat_priv->debug_log = kzalloc(sizeof(struct debug_log), GFP_ATOMIC); 188 bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC);
188 if (!bat_priv->debug_log) 189 if (!bat_priv->debug_log)
189 goto err; 190 goto err;
190 191