diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-06-22 13:31:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-22 14:32:23 -0400 |
commit | 56578abfd16a1a7554f64000d5fc0a377d4dda6a (patch) | |
tree | 541e56ef32af530ede568ce41cc40705770bbca1 /drivers/char | |
parent | dfa7c4d869b7d3d37b70f1de856f2901b6ebfcf0 (diff) |
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>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/bfin_jtag_comm.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/char/bfin_jtag_comm.c b/drivers/char/bfin_jtag_comm.c index 44c113d56045..1d7c34c73b20 100644 --- a/drivers/char/bfin_jtag_comm.c +++ b/drivers/char/bfin_jtag_comm.c | |||
@@ -8,6 +8,10 @@ | |||
8 | * Licensed under the GPL-2 or later. | 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 | #include <linux/circ_buf.h> | 15 | #include <linux/circ_buf.h> |
12 | #include <linux/console.h> | 16 | #include <linux/console.h> |
13 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
@@ -22,18 +26,14 @@ | |||
22 | #include <linux/tty_flip.h> | 26 | #include <linux/tty_flip.h> |
23 | #include <asm/atomic.h> | 27 | #include <asm/atomic.h> |
24 | 28 | ||
29 | #define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); }) | ||
30 | |||
25 | /* See the Debug/Emulation chapter in the HRM */ | 31 | /* See the Debug/Emulation chapter in the HRM */ |
26 | #define EMUDOF 0x00000001 /* EMUDAT_OUT full & valid */ | 32 | #define EMUDOF 0x00000001 /* EMUDAT_OUT full & valid */ |
27 | #define EMUDIF 0x00000002 /* EMUDAT_IN full & valid */ | 33 | #define EMUDIF 0x00000002 /* EMUDAT_IN full & valid */ |
28 | #define EMUDOOVF 0x00000004 /* EMUDAT_OUT overflow */ | 34 | #define EMUDOOVF 0x00000004 /* EMUDAT_OUT overflow */ |
29 | #define EMUDIOVF 0x00000008 /* EMUDAT_IN overflow */ | 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 | static inline uint32_t bfin_write_emudat(uint32_t emudat) | 37 | static inline uint32_t bfin_write_emudat(uint32_t emudat) |
38 | { | 38 | { |
39 | __asm__ __volatile__("emudat = %0;" : : "d"(emudat)); | 39 | __asm__ __volatile__("emudat = %0;" : : "d"(emudat)); |
@@ -74,7 +74,7 @@ bfin_jc_emudat_manager(void *arg) | |||
74 | while (!kthread_should_stop()) { | 74 | while (!kthread_should_stop()) { |
75 | /* no one left to give data to, so sleep */ | 75 | /* no one left to give data to, so sleep */ |
76 | if (bfin_jc_tty == NULL && circ_empty(&bfin_jc_write_buf)) { | 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 | __set_current_state(TASK_UNINTERRUPTIBLE); | 78 | __set_current_state(TASK_UNINTERRUPTIBLE); |
79 | schedule(); | 79 | schedule(); |
80 | __set_current_state(TASK_RUNNING); | 80 | __set_current_state(TASK_RUNNING); |
@@ -82,7 +82,7 @@ bfin_jc_emudat_manager(void *arg) | |||
82 | 82 | ||
83 | /* no data available, so just chill */ | 83 | /* no data available, so just chill */ |
84 | if (!(bfin_read_DBGSTAT() & EMUDIF) && circ_empty(&bfin_jc_write_buf)) { | 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 | inbound_len, bfin_jc_write_buf.tail, bfin_jc_write_buf.head); | 86 | inbound_len, bfin_jc_write_buf.tail, bfin_jc_write_buf.head); |
87 | if (inbound_len) | 87 | if (inbound_len) |
88 | schedule(); | 88 | schedule(); |
@@ -99,11 +99,11 @@ bfin_jc_emudat_manager(void *arg) | |||
99 | if (tty != NULL) { | 99 | if (tty != NULL) { |
100 | uint32_t emudat = bfin_read_emudat(); | 100 | uint32_t emudat = bfin_read_emudat(); |
101 | if (inbound_len == 0) { | 101 | if (inbound_len == 0) { |
102 | debug("incoming length: 0x%08x\n", emudat); | 102 | pr_debug("incoming length: 0x%08x\n", emudat); |
103 | inbound_len = emudat; | 103 | inbound_len = emudat; |
104 | } else { | 104 | } else { |
105 | size_t num_chars = (4 <= inbound_len ? 4 : inbound_len); | 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 | inbound_len -= num_chars; | 107 | inbound_len -= num_chars; |
108 | tty_insert_flip_string(tty, (unsigned char *)&emudat, num_chars); | 108 | tty_insert_flip_string(tty, (unsigned char *)&emudat, num_chars); |
109 | tty_flip_buffer_push(tty); | 109 | tty_flip_buffer_push(tty); |
@@ -117,7 +117,7 @@ bfin_jc_emudat_manager(void *arg) | |||
117 | if (outbound_len == 0) { | 117 | if (outbound_len == 0) { |
118 | outbound_len = circ_cnt(&bfin_jc_write_buf); | 118 | outbound_len = circ_cnt(&bfin_jc_write_buf); |
119 | bfin_write_emudat(outbound_len); | 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 | } else { | 121 | } else { |
122 | struct tty_struct *tty; | 122 | struct tty_struct *tty; |
123 | int tail = bfin_jc_write_buf.tail; | 123 | int tail = bfin_jc_write_buf.tail; |
@@ -136,7 +136,7 @@ bfin_jc_emudat_manager(void *arg) | |||
136 | if (tty) | 136 | if (tty) |
137 | tty_wakeup(tty); | 137 | tty_wakeup(tty); |
138 | mutex_unlock(&bfin_jc_tty_mutex); | 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 @@ static int | |||
149 | bfin_jc_open(struct tty_struct *tty, struct file *filp) | 149 | bfin_jc_open(struct tty_struct *tty, struct file *filp) |
150 | { | 150 | { |
151 | mutex_lock(&bfin_jc_tty_mutex); | 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 | ++bfin_jc_count; | 153 | ++bfin_jc_count; |
154 | bfin_jc_tty = tty; | 154 | bfin_jc_tty = tty; |
155 | wake_up_process(bfin_jc_kthread); | 155 | wake_up_process(bfin_jc_kthread); |
@@ -161,7 +161,7 @@ static void | |||
161 | bfin_jc_close(struct tty_struct *tty, struct file *filp) | 161 | bfin_jc_close(struct tty_struct *tty, struct file *filp) |
162 | { | 162 | { |
163 | mutex_lock(&bfin_jc_tty_mutex); | 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 | if (--bfin_jc_count == 0) | 165 | if (--bfin_jc_count == 0) |
166 | bfin_jc_tty = NULL; | 166 | bfin_jc_tty = NULL; |
167 | wake_up_process(bfin_jc_kthread); | 167 | wake_up_process(bfin_jc_kthread); |
@@ -174,7 +174,7 @@ bfin_jc_circ_write(const unsigned char *buf, int count) | |||
174 | { | 174 | { |
175 | int i; | 175 | int i; |
176 | count = min(count, circ_free(&bfin_jc_write_buf)); | 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 | for (i = 0; i < count; ++i) | 178 | for (i = 0; i < count; ++i) |
179 | circ_byte(&bfin_jc_write_buf, bfin_jc_write_buf.head + i) = buf[i]; | 179 | circ_byte(&bfin_jc_write_buf, bfin_jc_write_buf.head + i) = buf[i]; |
180 | bfin_jc_write_buf.head += i; | 180 | bfin_jc_write_buf.head += i; |