Skip to content

Commit

Permalink
lapb: Neaten debugging
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
JoePerches authored and davem330 committed May 17, 2012
1 parent a5e371f commit a508da6
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 306 deletions.
6 changes: 6 additions & 0 deletions include/net/lapb.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,10 @@ extern int lapb_t1timer_running(struct lapb_cb *lapb);
*/
#define LAPB_DEBUG 0

#define lapb_dbg(level, fmt, ...) \
do { \
if (level < LAPB_DEBUG) \
pr_debug(fmt, ##__VA_ARGS__); \
} while (0)

#endif
22 changes: 7 additions & 15 deletions net/lapb/lapb_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* 2000-10-29 Henner Eisen lapb_data_indication() return status.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/errno.h>
#include <linux/types.h>
Expand Down Expand Up @@ -279,9 +281,7 @@ int lapb_connect_request(struct net_device *dev)

lapb_establish_data_link(lapb);

#if LAPB_DEBUG > 0
printk(KERN_DEBUG "lapb: (%p) S0 -> S1\n", lapb->dev);
#endif
lapb_dbg(0, "(%p) S0 -> S1\n", lapb->dev);
lapb->state = LAPB_STATE_1;

rc = LAPB_OK;
Expand All @@ -305,12 +305,8 @@ int lapb_disconnect_request(struct net_device *dev)
goto out_put;

case LAPB_STATE_1:
#if LAPB_DEBUG > 1
printk(KERN_DEBUG "lapb: (%p) S1 TX DISC(1)\n", lapb->dev);
#endif
#if LAPB_DEBUG > 0
printk(KERN_DEBUG "lapb: (%p) S1 -> S0\n", lapb->dev);
#endif
lapb_dbg(1, "(%p) S1 TX DISC(1)\n", lapb->dev);
lapb_dbg(0, "(%p) S1 -> S0\n", lapb->dev);
lapb_send_control(lapb, LAPB_DISC, LAPB_POLLON, LAPB_COMMAND);
lapb->state = LAPB_STATE_0;
lapb_start_t1timer(lapb);
Expand All @@ -329,12 +325,8 @@ int lapb_disconnect_request(struct net_device *dev)
lapb_stop_t2timer(lapb);
lapb->state = LAPB_STATE_2;

#if LAPB_DEBUG > 1
printk(KERN_DEBUG "lapb: (%p) S3 DISC(1)\n", lapb->dev);
#endif
#if LAPB_DEBUG > 0
printk(KERN_DEBUG "lapb: (%p) S3 -> S2\n", lapb->dev);
#endif
lapb_dbg(1, "(%p) S3 DISC(1)\n", lapb->dev);
lapb_dbg(0, "(%p) S3 -> S2\n", lapb->dev);

rc = LAPB_OK;
out_put:
Expand Down
Loading

0 comments on commit a508da6

Please sign in to comment.