diff options
author | Joe Perches <joe@perches.com> | 2012-05-17 06:25:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-17 18:45:20 -0400 |
commit | a508da6cc0093171833efb8376b00473f24221b9 (patch) | |
tree | d2578008abfaf33a59da65a64b916c62ee79eedd /net/lapb/lapb_out.c | |
parent | a5e371f61ad33c07b28e7c9b60c78d71fdd34e2a (diff) |
lapb: Neaten debugging
Enable dynamic debugging and remove a bunch of #ifdef/#endifs.
Add a lapb_dbg(level, fmt, ...) macro and replace the
printk(KERN_DEBUG uses.
Add pr_fmt and remove embedded prefixes.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/lapb/lapb_out.c')
-rw-r--r-- | net/lapb/lapb_out.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/net/lapb/lapb_out.c b/net/lapb/lapb_out.c index baab2760f651..ba4d015bd1a6 100644 --- a/net/lapb/lapb_out.c +++ b/net/lapb/lapb_out.c | |||
@@ -14,6 +14,8 @@ | |||
14 | * LAPB 002 Jonathan Naylor New timer architecture. | 14 | * LAPB 002 Jonathan Naylor New timer architecture. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
18 | |||
17 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
18 | #include <linux/types.h> | 20 | #include <linux/types.h> |
19 | #include <linux/socket.h> | 21 | #include <linux/socket.h> |
@@ -60,10 +62,8 @@ static void lapb_send_iframe(struct lapb_cb *lapb, struct sk_buff *skb, int poll | |||
60 | *frame |= lapb->vs << 1; | 62 | *frame |= lapb->vs << 1; |
61 | } | 63 | } |
62 | 64 | ||
63 | #if LAPB_DEBUG > 1 | 65 | lapb_dbg(1, "(%p) S%d TX I(%d) S%d R%d\n", |
64 | printk(KERN_DEBUG "lapb: (%p) S%d TX I(%d) S%d R%d\n", | 66 | lapb->dev, lapb->state, poll_bit, lapb->vs, lapb->vr); |
65 | lapb->dev, lapb->state, poll_bit, lapb->vs, lapb->vr); | ||
66 | #endif | ||
67 | 67 | ||
68 | lapb_transmit_buffer(lapb, skb, LAPB_COMMAND); | 68 | lapb_transmit_buffer(lapb, skb, LAPB_COMMAND); |
69 | } | 69 | } |
@@ -148,11 +148,9 @@ void lapb_transmit_buffer(struct lapb_cb *lapb, struct sk_buff *skb, int type) | |||
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | #if LAPB_DEBUG > 2 | 151 | lapb_dbg(2, "(%p) S%d TX %02X %02X %02X\n", |
152 | printk(KERN_DEBUG "lapb: (%p) S%d TX %02X %02X %02X\n", | 152 | lapb->dev, lapb->state, |
153 | lapb->dev, lapb->state, | 153 | skb->data[0], skb->data[1], skb->data[2]); |
154 | skb->data[0], skb->data[1], skb->data[2]); | ||
155 | #endif | ||
156 | 154 | ||
157 | if (!lapb_data_transmit(lapb, skb)) | 155 | if (!lapb_data_transmit(lapb, skb)) |
158 | kfree_skb(skb); | 156 | kfree_skb(skb); |
@@ -164,16 +162,10 @@ void lapb_establish_data_link(struct lapb_cb *lapb) | |||
164 | lapb->n2count = 0; | 162 | lapb->n2count = 0; |
165 | 163 | ||
166 | if (lapb->mode & LAPB_EXTENDED) { | 164 | if (lapb->mode & LAPB_EXTENDED) { |
167 | #if LAPB_DEBUG > 1 | 165 | lapb_dbg(1, "(%p) S%d TX SABME(1)\n", lapb->dev, lapb->state); |
168 | printk(KERN_DEBUG "lapb: (%p) S%d TX SABME(1)\n", | ||
169 | lapb->dev, lapb->state); | ||
170 | #endif | ||
171 | lapb_send_control(lapb, LAPB_SABME, LAPB_POLLON, LAPB_COMMAND); | 166 | lapb_send_control(lapb, LAPB_SABME, LAPB_POLLON, LAPB_COMMAND); |
172 | } else { | 167 | } else { |
173 | #if LAPB_DEBUG > 1 | 168 | lapb_dbg(1, "(%p) S%d TX SABM(1)\n", lapb->dev, lapb->state); |
174 | printk(KERN_DEBUG "lapb: (%p) S%d TX SABM(1)\n", | ||
175 | lapb->dev, lapb->state); | ||
176 | #endif | ||
177 | lapb_send_control(lapb, LAPB_SABM, LAPB_POLLON, LAPB_COMMAND); | 169 | lapb_send_control(lapb, LAPB_SABM, LAPB_POLLON, LAPB_COMMAND); |
178 | } | 170 | } |
179 | 171 | ||
@@ -183,10 +175,8 @@ void lapb_establish_data_link(struct lapb_cb *lapb) | |||
183 | 175 | ||
184 | void lapb_enquiry_response(struct lapb_cb *lapb) | 176 | void lapb_enquiry_response(struct lapb_cb *lapb) |
185 | { | 177 | { |
186 | #if LAPB_DEBUG > 1 | 178 | lapb_dbg(1, "(%p) S%d TX RR(1) R%d\n", |
187 | printk(KERN_DEBUG "lapb: (%p) S%d TX RR(1) R%d\n", | 179 | lapb->dev, lapb->state, lapb->vr); |
188 | lapb->dev, lapb->state, lapb->vr); | ||
189 | #endif | ||
190 | 180 | ||
191 | lapb_send_control(lapb, LAPB_RR, LAPB_POLLON, LAPB_RESPONSE); | 181 | lapb_send_control(lapb, LAPB_RR, LAPB_POLLON, LAPB_RESPONSE); |
192 | 182 | ||
@@ -195,10 +185,8 @@ void lapb_enquiry_response(struct lapb_cb *lapb) | |||
195 | 185 | ||
196 | void lapb_timeout_response(struct lapb_cb *lapb) | 186 | void lapb_timeout_response(struct lapb_cb *lapb) |
197 | { | 187 | { |
198 | #if LAPB_DEBUG > 1 | 188 | lapb_dbg(1, "(%p) S%d TX RR(0) R%d\n", |
199 | printk(KERN_DEBUG "lapb: (%p) S%d TX RR(0) R%d\n", | 189 | lapb->dev, lapb->state, lapb->vr); |
200 | lapb->dev, lapb->state, lapb->vr); | ||
201 | #endif | ||
202 | lapb_send_control(lapb, LAPB_RR, LAPB_POLLOFF, LAPB_RESPONSE); | 190 | lapb_send_control(lapb, LAPB_RR, LAPB_POLLOFF, LAPB_RESPONSE); |
203 | 191 | ||
204 | lapb->condition &= ~LAPB_ACK_PENDING_CONDITION; | 192 | lapb->condition &= ~LAPB_ACK_PENDING_CONDITION; |