From patchwork Sat Jul 18 14:42:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 5114 Return-Path: Received: from ascomax.hasler.ascom.ch (ascomax.hasler.ascom.ch [139.79.135.1]) by open-mesh.net (Postfix) with ESMTPS id 4FF0C1543BA for ; Sat, 18 Jul 2009 15:07:00 +0000 (UTC) Received: from eiger.ma.tech.ascom.ch (eiger.ma.tech.ascom.ch [139.79.100.1]) by ascomax.hasler.ascom.ch (8.14.3/8.14.3) with ESMTP id n6IEggbW019206 for ; Sat, 18 Jul 2009 16:42:42 +0200 (MEST) Received: from [139.79.100.143] (helo=donkey.ma.tech.ascom.ch) by eiger.ma.tech.ascom.ch with esmtp (Exim 3.16 #1) id 1MSB7X-0002yb-00 for b.a.t.m.a.n@lists.open-mesh.net; Sat, 18 Jul 2009 16:42:39 +0200 Received: from lunn by donkey.ma.tech.ascom.ch with local (Exim 4.69) (envelope-from ) id 1MSB7a-0003Nl-6Q for b.a.t.m.a.n@lists.open-mesh.net; Sat, 18 Jul 2009 16:42:42 +0200 Date: Sat, 18 Jul 2009 16:42:42 +0200 From: Andrew Lunn To: "B.A.T.M.A.N" Message-ID: <20090718144242.GL4656@ma.tech.ascom.ch> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Subject: [B.A.T.M.A.N.] [batman-adv] Cleanup log.[ch] X-BeenThere: b.a.t.m.a.n@lists.open-mesh.net X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jul 2009 15:07:01 -0000 Make log.[ch] clean with respect to the 2.6.29 checkpatch script. Signed-off-by: Andrew Lunn Index: batman-adv-kernelland/log.c =================================================================== --- batman-adv-kernelland/log.c (revision 1351) +++ batman-adv-kernelland/log.c (working copy) @@ -17,28 +17,21 @@ * */ - - - - #include "main.h" #include "log.h" - #define LOG_BUF_MASK (log_buf_len-1) #define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK]) - - static char log_buf[LOG_BUF_LEN]; static int log_buf_len = LOG_BUF_LEN; -static unsigned long log_start = 0; -static unsigned long log_end = 0; -volatile uint8_t log_level = 0; +static unsigned long log_start; +static unsigned long log_end; +uint8_t log_level; static DEFINE_SPINLOCK(logbuf_lock); -struct file_operations proc_log_operations = { +const struct file_operations proc_log_operations = { .open = log_open, .release = log_release, .read = log_read, @@ -48,7 +41,6 @@ static DECLARE_WAIT_QUEUE_HEAD(log_wait); - static void emit_log_char(char c) { LOG_BUF(log_end) = c; @@ -68,7 +60,8 @@ spin_lock_irqsave(&logbuf_lock, flags); va_start(args, fmt); - printed_len = vscnprintf(debug_log_buf, sizeof(debug_log_buf), fmt, args); + printed_len = vscnprintf(debug_log_buf, sizeof(debug_log_buf), fmt, + args); va_end(args); for (p = debug_log_buf; *p != 0; p++) @@ -81,7 +74,6 @@ return 0; } - int debug_log(int type, char *fmt, ...) { va_list args; @@ -92,7 +84,7 @@ if (type == LOG_TYPE_CRIT) { va_start(args, fmt); vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); - printk("batman-adv: %s", tmp_log_buf); + printk(KERN_ERR "batman-adv: %s", tmp_log_buf); va_end(args); } @@ -106,19 +98,20 @@ return retval; } -int log_open(struct inode * inode, struct file * file) +int log_open(struct inode *inode, struct file *file) { inc_module_count(); return 0; } -int log_release(struct inode * inode, struct file * file) +int log_release(struct inode *inode, struct file *file) { dec_module_count(); return 0; } -ssize_t log_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) +ssize_t log_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos) { int error, i = 0; char c; @@ -150,7 +143,7 @@ spin_unlock_irqrestore(&logbuf_lock, flags); - error = __put_user(c,buf); + error = __put_user(c, buf); spin_lock_irqsave(&logbuf_lock, flags); @@ -167,7 +160,8 @@ return error; } -ssize_t log_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) +ssize_t log_write(struct file *file, const char __user *buf, size_t count, + loff_t *ppos) { return count; } @@ -181,4 +175,3 @@ return 0; } - Index: batman-adv-kernelland/log.h =================================================================== --- batman-adv-kernelland/log.h (revision 1351) +++ batman-adv-kernelland/log.h (working copy) @@ -17,18 +17,14 @@ * */ +extern const struct file_operations proc_log_operations; +extern uint8_t log_level; - - - -extern struct file_operations proc_log_operations; -extern volatile uint8_t log_level; - - int debug_log(int type, char *fmt, ...); -int log_open(struct inode * inode, struct file * file); -int log_release(struct inode * inode, struct file * file); -ssize_t log_read(struct file *file, char __user *buf, size_t count, loff_t *ppos); -ssize_t log_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos); +int log_open(struct inode *inode, struct file *file); +int log_release(struct inode *inode, struct file *file); +ssize_t log_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos); +ssize_t log_write(struct file *file, const char __user *buf, size_t count, + loff_t *ppos); unsigned int log_poll(struct file *file, poll_table *wait); -