aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-05-19 18:20:29 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-19 18:20:29 -0400
commit8fb53b959bd9e503b646a3d68c7b1759667b6a19 (patch)
treed9bc5f2a28c480da0045b715cfc852b5cae67bc3 /drivers/isdn
parent43a5f002afc6f24891e57d31275f34e19a1a07d0 (diff)
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: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/capi/capi.c115
1 files changed, 32 insertions, 83 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index bea100983336..e44933d58790 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -42,9 +42,6 @@ MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
42MODULE_AUTHOR("Carsten Paeth"); 42MODULE_AUTHOR("Carsten Paeth");
43MODULE_LICENSE("GPL"); 43MODULE_LICENSE("GPL");
44 44
45#undef _DEBUG_TTYFUNCS /* call to tty_driver */
46#undef _DEBUG_DATAFLOW /* data flow */
47
48/* -------- driver information -------------------------------------- */ 45/* -------- driver information -------------------------------------- */
49 46
50static DEFINE_MUTEX(capi_mutex); 47static DEFINE_MUTEX(capi_mutex);
@@ -418,9 +415,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
418 415
419 tty = tty_port_tty_get(&mp->port); 416 tty = tty_port_tty_get(&mp->port);
420 if (!tty) { 417 if (!tty) {
421#ifdef _DEBUG_DATAFLOW 418 pr_debug("capi: currently no receiver\n");
422 printk(KERN_DEBUG "capi: currently no receiver\n");
423#endif
424 return -1; 419 return -1;
425 } 420 }
426 421
@@ -433,23 +428,17 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
433 } 428 }
434 429
435 if (ld->ops->receive_buf == NULL) { 430 if (ld->ops->receive_buf == NULL) {
436#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) 431 pr_debug("capi: ldisc has no receive_buf function\n");
437 printk(KERN_DEBUG "capi: ldisc has no receive_buf function\n");
438#endif
439 /* fatal error, do not requeue */ 432 /* fatal error, do not requeue */
440 goto free_skb; 433 goto free_skb;
441 } 434 }
442 if (mp->ttyinstop) { 435 if (mp->ttyinstop) {
443#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) 436 pr_debug("capi: recv tty throttled\n");
444 printk(KERN_DEBUG "capi: recv tty throttled\n");
445#endif
446 goto deref_ldisc; 437 goto deref_ldisc;
447 } 438 }
448 439
449 if (tty->receive_room < datalen) { 440 if (tty->receive_room < datalen) {
450#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) 441 pr_debug("capi: no room in tty\n");
451 printk(KERN_DEBUG "capi: no room in tty\n");
452#endif
453 goto deref_ldisc; 442 goto deref_ldisc;
454 } 443 }
455 444
@@ -465,10 +454,8 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
465 454
466 if (errcode == CAPI_NOERROR) { 455 if (errcode == CAPI_NOERROR) {
467 skb_pull(skb, CAPIMSG_LEN(skb->data)); 456 skb_pull(skb, CAPIMSG_LEN(skb->data));
468#ifdef _DEBUG_DATAFLOW 457 pr_debug("capi: DATA_B3_RESP %u len=%d => ldisc\n",
469 printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ldisc\n", 458 datahandle, skb->len);
470 datahandle, skb->len);
471#endif
472 ld->ops->receive_buf(tty, skb->data, NULL, skb->len); 459 ld->ops->receive_buf(tty, skb->data, NULL, skb->len);
473 } else { 460 } else {
474 printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n", 461 printk(KERN_ERR "capi: send DATA_B3_RESP failed=%x\n",
@@ -515,9 +502,7 @@ static void handle_minor_send(struct capiminor *mp)
515 return; 502 return;
516 503
517 if (mp->ttyoutstop) { 504 if (mp->ttyoutstop) {
518#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) 505 pr_debug("capi: send: tty stopped\n");
519 printk(KERN_DEBUG "capi: send: tty stopped\n");
520#endif
521 tty_kref_put(tty); 506 tty_kref_put(tty);
522 return; 507 return;
523 } 508 }
@@ -559,10 +544,8 @@ static void handle_minor_send(struct capiminor *mp)
559 } 544 }
560 errcode = capi20_put_message(mp->ap, skb); 545 errcode = capi20_put_message(mp->ap, skb);
561 if (errcode == CAPI_NOERROR) { 546 if (errcode == CAPI_NOERROR) {
562#ifdef _DEBUG_DATAFLOW 547 pr_debug("capi: DATA_B3_REQ %u len=%u\n",
563 printk(KERN_DEBUG "capi: DATA_B3_REQ %u len=%u\n", 548 datahandle, len);
564 datahandle, len);
565#endif
566 continue; 549 continue;
567 } 550 }
568 capiminor_del_ack(mp, datahandle); 551 capiminor_del_ack(mp, datahandle);
@@ -636,10 +619,8 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
636 } 619 }
637 if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) { 620 if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) {
638 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+4+2); 621 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+4+2);
639#ifdef _DEBUG_DATAFLOW 622 pr_debug("capi_signal: DATA_B3_IND %u len=%d\n",
640 printk(KERN_DEBUG "capi_signal: DATA_B3_IND %u len=%d\n", 623 datahandle, skb->len-CAPIMSG_LEN(skb->data));
641 datahandle, skb->len-CAPIMSG_LEN(skb->data));
642#endif
643 skb_queue_tail(&mp->inqueue, skb); 624 skb_queue_tail(&mp->inqueue, skb);
644 625
645 handle_minor_recv(mp); 626 handle_minor_recv(mp);
@@ -647,11 +628,9 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
647 } else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) { 628 } else if (CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF) {
648 629
649 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4); 630 datahandle = CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4);
650#ifdef _DEBUG_DATAFLOW 631 pr_debug("capi_signal: DATA_B3_CONF %u 0x%x\n",
651 printk(KERN_DEBUG "capi_signal: DATA_B3_CONF %u 0x%x\n", 632 datahandle,
652 datahandle, 633 CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2));
653 CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2));
654#endif
655 kfree_skb(skb); 634 kfree_skb(skb);
656 capiminor_del_ack(mp, datahandle); 635 capiminor_del_ack(mp, datahandle);
657 tty = tty_port_tty_get(&mp->port); 636 tty = tty_port_tty_get(&mp->port);
@@ -1081,9 +1060,7 @@ static int capinc_tty_write(struct tty_struct *tty,
1081 struct capiminor *mp = tty->driver_data; 1060 struct capiminor *mp = tty->driver_data;
1082 struct sk_buff *skb; 1061 struct sk_buff *skb;
1083 1062
1084#ifdef _DEBUG_TTYFUNCS 1063 pr_debug("capinc_tty_write(count=%d)\n", count);
1085 printk(KERN_DEBUG "capinc_tty_write(count=%d)\n", count);
1086#endif
1087 1064
1088 spin_lock_bh(&mp->outlock); 1065 spin_lock_bh(&mp->outlock);
1089 skb = mp->outskb; 1066 skb = mp->outskb;
@@ -1119,9 +1096,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
1119 struct sk_buff *skb; 1096 struct sk_buff *skb;
1120 int ret = 1; 1097 int ret = 1;
1121 1098
1122#ifdef _DEBUG_TTYFUNCS 1099 pr_debug("capinc_put_char(%u)\n", ch);
1123 printk(KERN_DEBUG "capinc_put_char(%u)\n", ch);
1124#endif
1125 1100
1126 spin_lock_bh(&mp->outlock); 1101 spin_lock_bh(&mp->outlock);
1127 skb = mp->outskb; 1102 skb = mp->outskb;
@@ -1160,9 +1135,7 @@ static void capinc_tty_flush_chars(struct tty_struct *tty)
1160 struct capiminor *mp = tty->driver_data; 1135 struct capiminor *mp = tty->driver_data;
1161 struct sk_buff *skb; 1136 struct sk_buff *skb;
1162 1137
1163#ifdef _DEBUG_TTYFUNCS 1138 pr_debug("capinc_tty_flush_chars\n");
1164 printk(KERN_DEBUG "capinc_tty_flush_chars\n");
1165#endif
1166 1139
1167 spin_lock_bh(&mp->outlock); 1140 spin_lock_bh(&mp->outlock);
1168 skb = mp->outskb; 1141 skb = mp->outskb;
@@ -1186,9 +1159,7 @@ static int capinc_tty_write_room(struct tty_struct *tty)
1186 1159
1187 room = CAPINC_MAX_SENDQUEUE-skb_queue_len(&mp->outqueue); 1160 room = CAPINC_MAX_SENDQUEUE-skb_queue_len(&mp->outqueue);
1188 room *= CAPI_MAX_BLKSIZE; 1161 room *= CAPI_MAX_BLKSIZE;
1189#ifdef _DEBUG_TTYFUNCS 1162 pr_debug("capinc_tty_write_room = %d\n", room);
1190 printk(KERN_DEBUG "capinc_tty_write_room = %d\n", room);
1191#endif
1192 return room; 1163 return room;
1193} 1164}
1194 1165
@@ -1196,12 +1167,10 @@ static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
1196{ 1167{
1197 struct capiminor *mp = tty->driver_data; 1168 struct capiminor *mp = tty->driver_data;
1198 1169
1199#ifdef _DEBUG_TTYFUNCS 1170 pr_debug("capinc_tty_chars_in_buffer = %d nack=%d sq=%d rq=%d\n",
1200 printk(KERN_DEBUG "capinc_tty_chars_in_buffer = %d nack=%d sq=%d rq=%d\n", 1171 mp->outbytes, mp->nack,
1201 mp->outbytes, mp->nack, 1172 skb_queue_len(&mp->outqueue),
1202 skb_queue_len(&mp->outqueue), 1173 skb_queue_len(&mp->inqueue));
1203 skb_queue_len(&mp->inqueue));
1204#endif
1205 return mp->outbytes; 1174 return mp->outbytes;
1206} 1175}
1207 1176
@@ -1213,17 +1182,13 @@ static int capinc_tty_ioctl(struct tty_struct *tty,
1213 1182
1214static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old) 1183static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old)
1215{ 1184{
1216#ifdef _DEBUG_TTYFUNCS 1185 pr_debug("capinc_tty_set_termios\n");
1217 printk(KERN_DEBUG "capinc_tty_set_termios\n");
1218#endif
1219} 1186}
1220 1187
1221static void capinc_tty_throttle(struct tty_struct *tty) 1188static void capinc_tty_throttle(struct tty_struct *tty)
1222{ 1189{
1223 struct capiminor *mp = tty->driver_data; 1190 struct capiminor *mp = tty->driver_data;
1224#ifdef _DEBUG_TTYFUNCS 1191 pr_debug("capinc_tty_throttle\n");
1225 printk(KERN_DEBUG "capinc_tty_throttle\n");
1226#endif
1227 mp->ttyinstop = 1; 1192 mp->ttyinstop = 1;
1228} 1193}
1229 1194
@@ -1231,9 +1196,7 @@ static void capinc_tty_unthrottle(struct tty_struct *tty)
1231{ 1196{
1232 struct capiminor *mp = tty->driver_data; 1197 struct capiminor *mp = tty->driver_data;
1233 1198
1234#ifdef _DEBUG_TTYFUNCS 1199 pr_debug("capinc_tty_unthrottle\n");
1235 printk(KERN_DEBUG "capinc_tty_unthrottle\n");
1236#endif
1237 mp->ttyinstop = 0; 1200 mp->ttyinstop = 0;
1238 handle_minor_recv(mp); 1201 handle_minor_recv(mp);
1239} 1202}
@@ -1242,9 +1205,7 @@ static void capinc_tty_stop(struct tty_struct *tty)
1242{ 1205{
1243 struct capiminor *mp = tty->driver_data; 1206 struct capiminor *mp = tty->driver_data;
1244 1207
1245#ifdef _DEBUG_TTYFUNCS 1208 pr_debug("capinc_tty_stop\n");
1246 printk(KERN_DEBUG "capinc_tty_stop\n");
1247#endif
1248 mp->ttyoutstop = 1; 1209 mp->ttyoutstop = 1;
1249} 1210}
1250 1211
@@ -1252,9 +1213,7 @@ static void capinc_tty_start(struct tty_struct *tty)
1252{ 1213{
1253 struct capiminor *mp = tty->driver_data; 1214 struct capiminor *mp = tty->driver_data;
1254 1215
1255#ifdef _DEBUG_TTYFUNCS 1216 pr_debug("capinc_tty_start\n");
1256 printk(KERN_DEBUG "capinc_tty_start\n");
1257#endif
1258 mp->ttyoutstop = 0; 1217 mp->ttyoutstop = 0;
1259 handle_minor_send(mp); 1218 handle_minor_send(mp);
1260} 1219}
@@ -1263,39 +1222,29 @@ static void capinc_tty_hangup(struct tty_struct *tty)
1263{ 1222{
1264 struct capiminor *mp = tty->driver_data; 1223 struct capiminor *mp = tty->driver_data;
1265 1224
1266#ifdef _DEBUG_TTYFUNCS 1225 pr_debug("capinc_tty_hangup\n");
1267 printk(KERN_DEBUG "capinc_tty_hangup\n");
1268#endif
1269 tty_port_hangup(&mp->port); 1226 tty_port_hangup(&mp->port);
1270} 1227}
1271 1228
1272static int capinc_tty_break_ctl(struct tty_struct *tty, int state) 1229static int capinc_tty_break_ctl(struct tty_struct *tty, int state)
1273{ 1230{
1274#ifdef _DEBUG_TTYFUNCS 1231 pr_debug("capinc_tty_break_ctl(%d)\n", state);
1275 printk(KERN_DEBUG "capinc_tty_break_ctl(%d)\n", state);
1276#endif
1277 return 0; 1232 return 0;
1278} 1233}
1279 1234
1280static void capinc_tty_flush_buffer(struct tty_struct *tty) 1235static void capinc_tty_flush_buffer(struct tty_struct *tty)
1281{ 1236{
1282#ifdef _DEBUG_TTYFUNCS 1237 pr_debug("capinc_tty_flush_buffer\n");
1283 printk(KERN_DEBUG "capinc_tty_flush_buffer\n");
1284#endif
1285} 1238}
1286 1239
1287static void capinc_tty_set_ldisc(struct tty_struct *tty) 1240static void capinc_tty_set_ldisc(struct tty_struct *tty)
1288{ 1241{
1289#ifdef _DEBUG_TTYFUNCS 1242 pr_debug("capinc_tty_set_ldisc\n");
1290 printk(KERN_DEBUG "capinc_tty_set_ldisc\n");
1291#endif
1292} 1243}
1293 1244
1294static void capinc_tty_send_xchar(struct tty_struct *tty, char ch) 1245static void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
1295{ 1246{
1296#ifdef _DEBUG_TTYFUNCS 1247 pr_debug("capinc_tty_send_xchar(%d)\n", ch);
1297 printk(KERN_DEBUG "capinc_tty_send_xchar(%d)\n", ch);
1298#endif
1299} 1248}
1300 1249
1301static const struct tty_operations capinc_ops = { 1250static const struct tty_operations capinc_ops = {