Commit 56578abfd16a1a7554f64000d5fc0a377d4dda6a
Committed by
Linus Torvalds
1 parent
dfa7c4d869
Exists in
master
and in
7 other branches
bfin_jtag_comm: clean up printk usage
The original patch garned some feedback and a v2 was posted, but that version seems to have been missed when merging the driver. At any rate, this cleans up the printk usage as suggested by Jiri Slaby. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 15 additions and 15 deletions Side-by-side Diff
drivers/char/bfin_jtag_comm.c
... | ... | @@ -8,6 +8,10 @@ |
8 | 8 | * Licensed under the GPL-2 or later. |
9 | 9 | */ |
10 | 10 | |
11 | +#define DRV_NAME "bfin-jtag-comm" | |
12 | +#define DEV_NAME "ttyBFJC" | |
13 | +#define pr_fmt(fmt) DRV_NAME ": " fmt | |
14 | + | |
11 | 15 | #include <linux/circ_buf.h> |
12 | 16 | #include <linux/console.h> |
13 | 17 | #include <linux/delay.h> |
14 | 18 | |
... | ... | @@ -22,18 +26,14 @@ |
22 | 26 | #include <linux/tty_flip.h> |
23 | 27 | #include <asm/atomic.h> |
24 | 28 | |
29 | +#define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); }) | |
30 | + | |
25 | 31 | /* See the Debug/Emulation chapter in the HRM */ |
26 | 32 | #define EMUDOF 0x00000001 /* EMUDAT_OUT full & valid */ |
27 | 33 | #define EMUDIF 0x00000002 /* EMUDAT_IN full & valid */ |
28 | 34 | #define EMUDOOVF 0x00000004 /* EMUDAT_OUT overflow */ |
29 | 35 | #define EMUDIOVF 0x00000008 /* EMUDAT_IN overflow */ |
30 | 36 | |
31 | -#define DRV_NAME "bfin-jtag-comm" | |
32 | -#define DEV_NAME "ttyBFJC" | |
33 | - | |
34 | -#define pr_init(fmt, args...) ({ static const __initdata char __fmt[] = fmt; printk(__fmt, ## args); }) | |
35 | -#define debug(fmt, args...) pr_debug(DRV_NAME ": " fmt, ## args) | |
36 | - | |
37 | 37 | static inline uint32_t bfin_write_emudat(uint32_t emudat) |
38 | 38 | { |
39 | 39 | __asm__ __volatile__("emudat = %0;" : : "d"(emudat)); |
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | while (!kthread_should_stop()) { |
75 | 75 | /* no one left to give data to, so sleep */ |
76 | 76 | if (bfin_jc_tty == NULL && circ_empty(&bfin_jc_write_buf)) { |
77 | - debug("waiting for readers\n"); | |
77 | + pr_debug("waiting for readers\n"); | |
78 | 78 | __set_current_state(TASK_UNINTERRUPTIBLE); |
79 | 79 | schedule(); |
80 | 80 | __set_current_state(TASK_RUNNING); |
... | ... | @@ -82,7 +82,7 @@ |
82 | 82 | |
83 | 83 | /* no data available, so just chill */ |
84 | 84 | if (!(bfin_read_DBGSTAT() & EMUDIF) && circ_empty(&bfin_jc_write_buf)) { |
85 | - debug("waiting for data (in_len = %i) (circ: %i %i)\n", | |
85 | + pr_debug("waiting for data (in_len = %i) (circ: %i %i)\n", | |
86 | 86 | inbound_len, bfin_jc_write_buf.tail, bfin_jc_write_buf.head); |
87 | 87 | if (inbound_len) |
88 | 88 | schedule(); |
89 | 89 | |
... | ... | @@ -99,11 +99,11 @@ |
99 | 99 | if (tty != NULL) { |
100 | 100 | uint32_t emudat = bfin_read_emudat(); |
101 | 101 | if (inbound_len == 0) { |
102 | - debug("incoming length: 0x%08x\n", emudat); | |
102 | + pr_debug("incoming length: 0x%08x\n", emudat); | |
103 | 103 | inbound_len = emudat; |
104 | 104 | } else { |
105 | 105 | size_t num_chars = (4 <= inbound_len ? 4 : inbound_len); |
106 | - debug(" incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars); | |
106 | + pr_debug(" incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars); | |
107 | 107 | inbound_len -= num_chars; |
108 | 108 | tty_insert_flip_string(tty, (unsigned char *)&emudat, num_chars); |
109 | 109 | tty_flip_buffer_push(tty); |
... | ... | @@ -117,7 +117,7 @@ |
117 | 117 | if (outbound_len == 0) { |
118 | 118 | outbound_len = circ_cnt(&bfin_jc_write_buf); |
119 | 119 | bfin_write_emudat(outbound_len); |
120 | - debug("outgoing length: 0x%08x\n", outbound_len); | |
120 | + pr_debug("outgoing length: 0x%08x\n", outbound_len); | |
121 | 121 | } else { |
122 | 122 | struct tty_struct *tty; |
123 | 123 | int tail = bfin_jc_write_buf.tail; |
... | ... | @@ -136,7 +136,7 @@ |
136 | 136 | if (tty) |
137 | 137 | tty_wakeup(tty); |
138 | 138 | mutex_unlock(&bfin_jc_tty_mutex); |
139 | - debug(" outgoing data: 0x%08x (pushing %zu)\n", emudat, ate); | |
139 | + pr_debug(" outgoing data: 0x%08x (pushing %zu)\n", emudat, ate); | |
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
... | ... | @@ -149,7 +149,7 @@ |
149 | 149 | bfin_jc_open(struct tty_struct *tty, struct file *filp) |
150 | 150 | { |
151 | 151 | mutex_lock(&bfin_jc_tty_mutex); |
152 | - debug("open %lu\n", bfin_jc_count); | |
152 | + pr_debug("open %lu\n", bfin_jc_count); | |
153 | 153 | ++bfin_jc_count; |
154 | 154 | bfin_jc_tty = tty; |
155 | 155 | wake_up_process(bfin_jc_kthread); |
... | ... | @@ -161,7 +161,7 @@ |
161 | 161 | bfin_jc_close(struct tty_struct *tty, struct file *filp) |
162 | 162 | { |
163 | 163 | mutex_lock(&bfin_jc_tty_mutex); |
164 | - debug("close %lu\n", bfin_jc_count); | |
164 | + pr_debug("close %lu\n", bfin_jc_count); | |
165 | 165 | if (--bfin_jc_count == 0) |
166 | 166 | bfin_jc_tty = NULL; |
167 | 167 | wake_up_process(bfin_jc_kthread); |
... | ... | @@ -174,7 +174,7 @@ |
174 | 174 | { |
175 | 175 | int i; |
176 | 176 | count = min(count, circ_free(&bfin_jc_write_buf)); |
177 | - debug("going to write chunk of %i bytes\n", count); | |
177 | + pr_debug("going to write chunk of %i bytes\n", count); | |
178 | 178 | for (i = 0; i < count; ++i) |
179 | 179 | circ_byte(&bfin_jc_write_buf, bfin_jc_write_buf.head + i) = buf[i]; |
180 | 180 | bfin_jc_write_buf.head += i; |