Commit 8fb53b95 authored by David S. Miller's avatar David S. Miller

isdn: capi: Use pr_debug() instead of ifdefs.

I was investigating some warnings that spew because of the
_DEBUG_FOO ifdef'ery in here.

Instead of adding more ifdefs to fix that warning, let's use
pr_debug() and get rid of these CPP checks altogether.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 43a5f002
...@@ -42,9 +42,6 @@ MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface"); ...@@ -42,9 +42,6 @@ MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
MODULE_AUTHOR("Carsten Paeth"); MODULE_AUTHOR("Carsten Paeth");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#undef _DEBUG_TTYFUNCS /* call to tty_driver */
#undef _DEBUG_DATAFLOW /* data flow */
/* -------- driver information -------------------------------------- */ /* -------- driver information -------------------------------------- */
static DEFINE_MUTEX(capi_mutex); static DEFINE_MUTEX(capi_mutex);
...@@ -418,9 +415,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) ...@@ -418,9 +415,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
tty = tty_port_tty_get(&mp->port); tty = tty_port_tty_get(&mp->port);
if (!tty) { if (!tty) {
#ifdef _DEBUG_DATAFLOW pr_debug("capi: currently no receiver\n");
printk(KERN_DEBUG "capi: currently no receiver\n");
#endif
return -1; return -1;
} }
...@@ -433,23 +428,17 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) ...@@ -433,23 +428,17 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
} }
if (ld->ops->receive_buf == NULL) { if (ld->ops->receive_buf == NULL) {
#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) pr_debug("capi: ldisc has no receive_buf function\n");
printk(KERN_DEBUG "capi: ldisc has no receive_buf function\n");
#endif
/* fatal error, do not requeue */ /* fatal error, do not requeue */
goto free_skb; goto free_skb;
} }
if (mp->ttyinstop) { if (mp->ttyinstop) {
#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) pr_debug("capi: recv tty throttled\n");
printk(KERN_DEBUG "capi: recv tty throttled\n");
#endif
goto deref_ldisc; goto deref_ldisc;
} }
if (tty->receive_room < datalen) { if (tty->receive_room < datalen) {
#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) pr_debug("capi: no room in tty\n");
printk(KERN_DEBUG "capi: no room in tty\n");
#endif
goto deref_ldisc; goto deref_ldisc;
} }
...@@ -465,10 +454,8 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) ...@@ -465,10 +454,8 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
if (errcode == CAPI_NOERROR) { if (errcode == CAPI_NOERROR) {
skb_pull(skb, CAPIMSG_LEN(skb->data)); skb_pull(skb, CAPIMSG_LEN(skb->data));
#ifdef _DEBUG_DATAFLOW pr_debug("capi: DATA_B3_RESP %u len=%d => ldisc\n",
printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ldisc\n", datahandle, skb->len);
datahandle, skb->len);
#endif
ld->ops->receive_buf(tty, skb->data, NULL, skb->len); ld->ops->receive_buf(tty, skb->data, NULL, skb->len);
} else { } else {
printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n", printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
...@@ -515,9 +502,7 @@ static void handle_minor_send(struct capiminor *mp) ...@@ -515,9 +502,7 @@ static void handle_minor_send(struct capiminor *mp)
return; return;
if (mp->ttyoutstop) { if (mp->ttyoutstop) {
#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) pr_debug("capi: send: tty stopped\n");
printk(KERN_DEBUG "capi: send: tty stopped\n");
#endif
tty_kref_put(tty); tty_kref_put(tty);
return; return;
} }
...@@ -559,10 +544,8 @@ static void handle_minor_send(struct capiminor *mp) ...@@ -559,10 +544,8 @@ static void handle_minor_send(struct capiminor *mp)
} }
errcode = capi20_put_message(mp->ap, skb); errcode = capi20_put_message(mp->ap, skb);
if (errcode == CAPI_NOERROR) { if (errcode == CAPI_NOERROR) {
#ifdef _DEBUG_DATAFLOW pr_debug("capi: DATA_B3_REQ %u len=%u\n",
printk(KERN_DEBUG "capi: DATA_B3_REQ %u len=%u\n", datahandle, len);
datahandle, len);
#endif
continue; continue;
} }
capiminor_del_ack(mp, datahandle); capiminor_del_ack(mp, datahandle);
...@@ -636,10 +619,8 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) ...@@ -636,10 +619,8 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
} }
if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) { if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) {
datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+4+2); datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+4+2);
#ifdef _DEBUG_DATAFLOW pr_debug("capi_signal: DATA_B3_IND %u len=%d\n",
printk(KERN_DEBUG "capi_signal: DATA_B3_IND %u len=%d\n", datahandle, skb->len-CAPIMSG_LEN(skb->data));
datahandle, skb->len-CAPIMSG_LEN(skb->data));
#endif
skb_queue_tail(&mp->inqueue, skb); skb_queue_tail(&mp->inqueue, skb);
handle_minor_recv(mp); handle_minor_recv(mp);
...@@ -647,11 +628,9 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) ...@@ -647,11 +628,9 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
} else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) { } else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) {
datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4); datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4);
#ifdef _DEBUG_DATAFLOW pr_debug("capi_signal: DATA_B3_CONF %u 0x%x\n",
printk(KERN_DEBUG "capi_signal: DATA_B3_CONF %u 0x%x\n", datahandle,
datahandle, CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2));
CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2));
#endif
kfree_skb(skb); kfree_skb(skb);
capiminor_del_ack(mp, datahandle); capiminor_del_ack(mp, datahandle);
tty = tty_port_tty_get(&mp->port); tty = tty_port_tty_get(&mp->port);
...@@ -1081,9 +1060,7 @@ static int capinc_tty_write(struct tty_struct *tty, ...@@ -1081,9 +1060,7 @@ static int capinc_tty_write(struct tty_struct *tty,
struct capiminor *mp = tty->driver_data; struct capiminor *mp = tty->driver_data;
struct sk_buff *skb; struct sk_buff *skb;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_write(count=%d)\n", count);
printk(KERN_DEBUG "capinc_tty_write(count=%d)\n", count);
#endif
spin_lock_bh(&mp->outlock); spin_lock_bh(&mp->outlock);
skb = mp->outskb; skb = mp->outskb;
...@@ -1119,9 +1096,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) ...@@ -1119,9 +1096,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
struct sk_buff *skb; struct sk_buff *skb;
int ret = 1; int ret = 1;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_put_char(%u)\n", ch);
printk(KERN_DEBUG "capinc_put_char(%u)\n", ch);
#endif
spin_lock_bh(&mp->outlock); spin_lock_bh(&mp->outlock);
skb = mp->outskb; skb = mp->outskb;
...@@ -1160,9 +1135,7 @@ static void capinc_tty_flush_chars(struct tty_struct *tty) ...@@ -1160,9 +1135,7 @@ static void capinc_tty_flush_chars(struct tty_struct *tty)
struct capiminor *mp = tty->driver_data; struct capiminor *mp = tty->driver_data;
struct sk_buff *skb; struct sk_buff *skb;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_flush_chars\n");
printk(KERN_DEBUG "capinc_tty_flush_chars\n");
#endif
spin_lock_bh(&mp->outlock); spin_lock_bh(&mp->outlock);
skb = mp->outskb; skb = mp->outskb;
...@@ -1186,9 +1159,7 @@ static int capinc_tty_write_room(struct tty_struct *tty) ...@@ -1186,9 +1159,7 @@ static int capinc_tty_write_room(struct tty_struct *tty)
room = CAPINC_MAX_SENDQUEUE-skb_queue_len(&mp->outqueue); room = CAPINC_MAX_SENDQUEUE-skb_queue_len(&mp->outqueue);
room *= CAPI_MAX_BLKSIZE; room *= CAPI_MAX_BLKSIZE;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_write_room = %d\n", room);
printk(KERN_DEBUG "capinc_tty_write_room = %d\n", room);
#endif
return room; return room;
} }
...@@ -1196,12 +1167,10 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty) ...@@ -1196,12 +1167,10 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
{ {
struct capiminor *mp = tty->driver_data; struct capiminor *mp = tty->driver_data;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_chars_in_buffer = %d nack=%d sq=%d rq=%d\n",
printk(KERN_DEBUG "capinc_tty_chars_in_buffer = %d nack=%d sq=%d rq=%d\n", mp->outbytes, mp->nack,
mp->outbytes, mp->nack, skb_queue_len(&mp->outqueue),
skb_queue_len(&mp->outqueue), skb_queue_len(&mp->inqueue));
skb_queue_len(&mp->inqueue));
#endif
return mp->outbytes; return mp->outbytes;
} }
...@@ -1213,17 +1182,13 @@ static int capinc_tty_ioctl(struct tty_struct *tty, ...@@ -1213,17 +1182,13 @@ static int capinc_tty_ioctl(struct tty_struct *tty,
static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old) static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old)
{ {
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_set_termios\n");
printk(KERN_DEBUG "capinc_tty_set_termios\n");
#endif
} }
static void capinc_tty_throttle(struct tty_struct *tty) static void capinc_tty_throttle(struct tty_struct *tty)
{ {
struct capiminor *mp = tty->driver_data; struct capiminor *mp = tty->driver_data;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_throttle\n");
printk(KERN_DEBUG "capinc_tty_throttle\n");
#endif
mp->ttyinstop = 1; mp->ttyinstop = 1;
} }
...@@ -1231,9 +1196,7 @@ static void capinc_tty_unthrottle(struct tty_struct *tty) ...@@ -1231,9 +1196,7 @@ static void capinc_tty_unthrottle(struct tty_struct *tty)
{ {
struct capiminor *mp = tty->driver_data; struct capiminor *mp = tty->driver_data;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_unthrottle\n");
printk(KERN_DEBUG "capinc_tty_unthrottle\n");
#endif
mp->ttyinstop = 0; mp->ttyinstop = 0;
handle_minor_recv(mp); handle_minor_recv(mp);
} }
...@@ -1242,9 +1205,7 @@ static void capinc_tty_stop(struct tty_struct *tty) ...@@ -1242,9 +1205,7 @@ static void capinc_tty_stop(struct tty_struct *tty)
{ {
struct capiminor *mp = tty->driver_data; struct capiminor *mp = tty->driver_data;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_stop\n");
printk(KERN_DEBUG "capinc_tty_stop\n");
#endif
mp->ttyoutstop = 1; mp->ttyoutstop = 1;
} }
...@@ -1252,9 +1213,7 @@ static void capinc_tty_start(struct tty_struct *tty) ...@@ -1252,9 +1213,7 @@ static void capinc_tty_start(struct tty_struct *tty)
{ {
struct capiminor *mp = tty->driver_data; struct capiminor *mp = tty->driver_data;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_start\n");
printk(KERN_DEBUG "capinc_tty_start\n");
#endif
mp->ttyoutstop = 0; mp->ttyoutstop = 0;
handle_minor_send(mp); handle_minor_send(mp);
} }
...@@ -1263,39 +1222,29 @@ static void capinc_tty_hangup(struct tty_struct *tty) ...@@ -1263,39 +1222,29 @@ static void capinc_tty_hangup(struct tty_struct *tty)
{ {
struct capiminor *mp = tty->driver_data; struct capiminor *mp = tty->driver_data;
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_hangup\n");
printk(KERN_DEBUG "capinc_tty_hangup\n");
#endif
tty_port_hangup(&mp->port); tty_port_hangup(&mp->port);
} }
static int capinc_tty_break_ctl(struct tty_struct *tty, int state) static int capinc_tty_break_ctl(struct tty_struct *tty, int state)
{ {
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_break_ctl(%d)\n", state);
printk(KERN_DEBUG "capinc_tty_break_ctl(%d)\n", state);
#endif
return 0; return 0;
} }
static void capinc_tty_flush_buffer(struct tty_struct *tty) static void capinc_tty_flush_buffer(struct tty_struct *tty)
{ {
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_flush_buffer\n");
printk(KERN_DEBUG "capinc_tty_flush_buffer\n");
#endif
} }
static void capinc_tty_set_ldisc(struct tty_struct *tty) static void capinc_tty_set_ldisc(struct tty_struct *tty)
{ {
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_set_ldisc\n");
printk(KERN_DEBUG "capinc_tty_set_ldisc\n");
#endif
} }
static void capinc_tty_send_xchar(struct tty_struct *tty, char ch) static void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
{ {
#ifdef _DEBUG_TTYFUNCS pr_debug("capinc_tty_send_xchar(%d)\n", ch);
printk(KERN_DEBUG "capinc_tty_send_xchar(%d)\n", ch);
#endif
} }
static const struct tty_operations capinc_ops = { static const struct tty_operations capinc_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment