aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irlmp.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-11-11 17:44:57 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-12 13:56:41 -0500
commit955a9d202f470019f42979f0d1caec98843e39ce (patch)
treefff6124b339bc33e3b5c67668bfcc13098be865c /net/irda/irlmp.c
parent8d326d818a2a8fc80c7df85dd88cb214804d1499 (diff)
irda: Convert IRDA_DEBUG to pr_debug
Use the normal kernel debugging mechanism which also enables dynamic_debug at the same time. Other miscellanea: o Remove sysctl for irda_debug o Remove function tracing like uses (use ftrace instead) o Coalesce formats o Realign arguments o Remove unnecessary OOM messages Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda/irlmp.c')
-rw-r--r--net/irda/irlmp.c167
1 files changed, 66 insertions, 101 deletions
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index 6178e71f3a51..a26c401ef4a4 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -83,7 +83,6 @@ const char *irlmp_reason_str(LM_REASON reason)
83 */ 83 */
84int __init irlmp_init(void) 84int __init irlmp_init(void)
85{ 85{
86 IRDA_DEBUG(1, "%s()\n", __func__);
87 /* Initialize the irlmp structure. */ 86 /* Initialize the irlmp structure. */
88 irlmp = kzalloc( sizeof(struct irlmp_cb), GFP_KERNEL); 87 irlmp = kzalloc( sizeof(struct irlmp_cb), GFP_KERNEL);
89 if (irlmp == NULL) 88 if (irlmp == NULL)
@@ -207,8 +206,6 @@ EXPORT_SYMBOL(irlmp_open_lsap);
207 */ 206 */
208static void __irlmp_close_lsap(struct lsap_cb *self) 207static void __irlmp_close_lsap(struct lsap_cb *self)
209{ 208{
210 IRDA_DEBUG(4, "%s()\n", __func__);
211
212 IRDA_ASSERT(self != NULL, return;); 209 IRDA_ASSERT(self != NULL, return;);
213 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;); 210 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
214 211
@@ -267,9 +264,8 @@ void irlmp_close_lsap(struct lsap_cb *self)
267 NULL); 264 NULL);
268 } 265 }
269 if (!lsap) { 266 if (!lsap) {
270 IRDA_DEBUG(0, 267 pr_debug("%s(), Looks like somebody has removed me already!\n",
271 "%s(), Looks like somebody has removed me already!\n", 268 __func__);
272 __func__);
273 return; 269 return;
274 } 270 }
275 __irlmp_close_lsap(self); 271 __irlmp_close_lsap(self);
@@ -340,8 +336,6 @@ void irlmp_unregister_link(__u32 saddr)
340{ 336{
341 struct lap_cb *link; 337 struct lap_cb *link;
342 338
343 IRDA_DEBUG(4, "%s()\n", __func__);
344
345 /* We must remove ourselves from the hashbin *first*. This ensure 339 /* We must remove ourselves from the hashbin *first*. This ensure
346 * that no more LSAPs will be open on this link and no discovery 340 * that no more LSAPs will be open on this link and no discovery
347 * will be triggered anymore. Jean II */ 341 * will be triggered anymore. Jean II */
@@ -383,9 +377,8 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
383 IRDA_ASSERT(self != NULL, return -EBADR;); 377 IRDA_ASSERT(self != NULL, return -EBADR;);
384 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return -EBADR;); 378 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return -EBADR;);
385 379
386 IRDA_DEBUG(2, 380 pr_debug("%s(), slsap_sel=%02x, dlsap_sel=%02x, saddr=%08x, daddr=%08x\n",
387 "%s(), slsap_sel=%02x, dlsap_sel=%02x, saddr=%08x, daddr=%08x\n", 381 __func__, self->slsap_sel, dlsap_sel, saddr, daddr);
388 __func__, self->slsap_sel, dlsap_sel, saddr, daddr);
389 382
390 if (test_bit(0, &self->connected)) { 383 if (test_bit(0, &self->connected)) {
391 ret = -EISCONN; 384 ret = -EISCONN;
@@ -429,7 +422,7 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
429 if (daddr != DEV_ADDR_ANY) 422 if (daddr != DEV_ADDR_ANY)
430 discovery = hashbin_find(irlmp->cachelog, daddr, NULL); 423 discovery = hashbin_find(irlmp->cachelog, daddr, NULL);
431 else { 424 else {
432 IRDA_DEBUG(2, "%s(), no daddr\n", __func__); 425 pr_debug("%s(), no daddr\n", __func__);
433 discovery = (discovery_t *) 426 discovery = (discovery_t *)
434 hashbin_get_first(irlmp->cachelog); 427 hashbin_get_first(irlmp->cachelog);
435 } 428 }
@@ -442,7 +435,7 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
442 } 435 }
443 lap = hashbin_lock_find(irlmp->links, saddr, NULL); 436 lap = hashbin_lock_find(irlmp->links, saddr, NULL);
444 if (lap == NULL) { 437 if (lap == NULL) {
445 IRDA_DEBUG(1, "%s(), Unable to find a usable link!\n", __func__); 438 pr_debug("%s(), Unable to find a usable link!\n", __func__);
446 ret = -EHOSTUNREACH; 439 ret = -EHOSTUNREACH;
447 goto err; 440 goto err;
448 } 441 }
@@ -457,14 +450,15 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
457 * disconnected yet (waiting for timeout in LAP). 450 * disconnected yet (waiting for timeout in LAP).
458 * Maybe we could give LAP a bit of help in this case. 451 * Maybe we could give LAP a bit of help in this case.
459 */ 452 */
460 IRDA_DEBUG(0, "%s(), sorry, but I'm waiting for LAP to timeout!\n", __func__); 453 pr_debug("%s(), sorry, but I'm waiting for LAP to timeout!\n",
454 __func__);
461 ret = -EAGAIN; 455 ret = -EAGAIN;
462 goto err; 456 goto err;
463 } 457 }
464 458
465 /* LAP is already connected to a different node, and LAP 459 /* LAP is already connected to a different node, and LAP
466 * can only talk to one node at a time */ 460 * can only talk to one node at a time */
467 IRDA_DEBUG(0, "%s(), sorry, but link is busy!\n", __func__); 461 pr_debug("%s(), sorry, but link is busy!\n", __func__);
468 ret = -EBUSY; 462 ret = -EBUSY;
469 goto err; 463 goto err;
470 } 464 }
@@ -525,8 +519,8 @@ void irlmp_connect_indication(struct lsap_cb *self, struct sk_buff *skb)
525 IRDA_ASSERT(skb != NULL, return;); 519 IRDA_ASSERT(skb != NULL, return;);
526 IRDA_ASSERT(self->lap != NULL, return;); 520 IRDA_ASSERT(self->lap != NULL, return;);
527 521
528 IRDA_DEBUG(2, "%s(), slsap_sel=%02x, dlsap_sel=%02x\n", 522 pr_debug("%s(), slsap_sel=%02x, dlsap_sel=%02x\n",
529 __func__, self->slsap_sel, self->dlsap_sel); 523 __func__, self->slsap_sel, self->dlsap_sel);
530 524
531 /* Note : self->lap is set in irlmp_link_data_indication(), 525 /* Note : self->lap is set in irlmp_link_data_indication(),
532 * (case CONNECT_CMD:) because we have no way to set it here. 526 * (case CONNECT_CMD:) because we have no way to set it here.
@@ -566,8 +560,8 @@ int irlmp_connect_response(struct lsap_cb *self, struct sk_buff *userdata)
566 /* We set the connected bit and move the lsap to the connected list 560 /* We set the connected bit and move the lsap to the connected list
567 * in the state machine itself. Jean II */ 561 * in the state machine itself. Jean II */
568 562
569 IRDA_DEBUG(2, "%s(), slsap_sel=%02x, dlsap_sel=%02x\n", 563 pr_debug("%s(), slsap_sel=%02x, dlsap_sel=%02x\n",
570 __func__, self->slsap_sel, self->dlsap_sel); 564 __func__, self->slsap_sel, self->dlsap_sel);
571 565
572 /* Make room for MUX control header (3 bytes) */ 566 /* Make room for MUX control header (3 bytes) */
573 IRDA_ASSERT(skb_headroom(userdata) >= LMP_CONTROL_HEADER, return -1;); 567 IRDA_ASSERT(skb_headroom(userdata) >= LMP_CONTROL_HEADER, return -1;);
@@ -593,8 +587,6 @@ void irlmp_connect_confirm(struct lsap_cb *self, struct sk_buff *skb)
593 int lap_header_size; 587 int lap_header_size;
594 int max_seg_size; 588 int max_seg_size;
595 589
596 IRDA_DEBUG(3, "%s()\n", __func__);
597
598 IRDA_ASSERT(skb != NULL, return;); 590 IRDA_ASSERT(skb != NULL, return;);
599 IRDA_ASSERT(self != NULL, return;); 591 IRDA_ASSERT(self != NULL, return;);
600 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;); 592 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
@@ -606,8 +598,8 @@ void irlmp_connect_confirm(struct lsap_cb *self, struct sk_buff *skb)
606 lap_header_size = IRLAP_GET_HEADER_SIZE(self->lap->irlap); 598 lap_header_size = IRLAP_GET_HEADER_SIZE(self->lap->irlap);
607 max_header_size = LMP_HEADER + lap_header_size; 599 max_header_size = LMP_HEADER + lap_header_size;
608 600
609 IRDA_DEBUG(2, "%s(), max_header_size=%d\n", 601 pr_debug("%s(), max_header_size=%d\n",
610 __func__, max_header_size); 602 __func__, max_header_size);
611 603
612 /* Hide LMP_CONTROL_HEADER header from layer above */ 604 /* Hide LMP_CONTROL_HEADER header from layer above */
613 skb_pull(skb, LMP_CONTROL_HEADER); 605 skb_pull(skb, LMP_CONTROL_HEADER);
@@ -633,16 +625,14 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
633 struct lsap_cb *new; 625 struct lsap_cb *new;
634 unsigned long flags; 626 unsigned long flags;
635 627
636 IRDA_DEBUG(1, "%s()\n", __func__);
637
638 spin_lock_irqsave(&irlmp->unconnected_lsaps->hb_spinlock, flags); 628 spin_lock_irqsave(&irlmp->unconnected_lsaps->hb_spinlock, flags);
639 629
640 /* Only allowed to duplicate unconnected LSAP's, and only LSAPs 630 /* Only allowed to duplicate unconnected LSAP's, and only LSAPs
641 * that have received a connect indication. Jean II */ 631 * that have received a connect indication. Jean II */
642 if ((!hashbin_find(irlmp->unconnected_lsaps, (long) orig, NULL)) || 632 if ((!hashbin_find(irlmp->unconnected_lsaps, (long) orig, NULL)) ||
643 (orig->lap == NULL)) { 633 (orig->lap == NULL)) {
644 IRDA_DEBUG(0, "%s(), invalid LSAP (wrong state)\n", 634 pr_debug("%s(), invalid LSAP (wrong state)\n",
645 __func__); 635 __func__);
646 spin_unlock_irqrestore(&irlmp->unconnected_lsaps->hb_spinlock, 636 spin_unlock_irqrestore(&irlmp->unconnected_lsaps->hb_spinlock,
647 flags); 637 flags);
648 return NULL; 638 return NULL;
@@ -651,7 +641,7 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
651 /* Allocate a new instance */ 641 /* Allocate a new instance */
652 new = kmemdup(orig, sizeof(*new), GFP_ATOMIC); 642 new = kmemdup(orig, sizeof(*new), GFP_ATOMIC);
653 if (!new) { 643 if (!new) {
654 IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __func__); 644 pr_debug("%s(), unable to kmalloc\n", __func__);
655 spin_unlock_irqrestore(&irlmp->unconnected_lsaps->hb_spinlock, 645 spin_unlock_irqrestore(&irlmp->unconnected_lsaps->hb_spinlock,
656 flags); 646 flags);
657 return NULL; 647 return NULL;
@@ -697,7 +687,7 @@ int irlmp_disconnect_request(struct lsap_cb *self, struct sk_buff *userdata)
697 * and us that might mess up the hashbins below. This fixes it. 687 * and us that might mess up the hashbins below. This fixes it.
698 * Jean II */ 688 * Jean II */
699 if (! test_and_clear_bit(0, &self->connected)) { 689 if (! test_and_clear_bit(0, &self->connected)) {
700 IRDA_DEBUG(0, "%s(), already disconnected!\n", __func__); 690 pr_debug("%s(), already disconnected!\n", __func__);
701 dev_kfree_skb(userdata); 691 dev_kfree_skb(userdata);
702 return -1; 692 return -1;
703 } 693 }
@@ -751,20 +741,20 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
751{ 741{
752 struct lsap_cb *lsap; 742 struct lsap_cb *lsap;
753 743
754 IRDA_DEBUG(1, "%s(), reason=%s [%d]\n", __func__, 744 pr_debug("%s(), reason=%s [%d]\n", __func__,
755 irlmp_reason_str(reason), reason); 745 irlmp_reason_str(reason), reason);
756 IRDA_ASSERT(self != NULL, return;); 746 IRDA_ASSERT(self != NULL, return;);
757 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;); 747 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
758 748
759 IRDA_DEBUG(3, "%s(), slsap_sel=%02x, dlsap_sel=%02x\n", 749 pr_debug("%s(), slsap_sel=%02x, dlsap_sel=%02x\n",
760 __func__, self->slsap_sel, self->dlsap_sel); 750 __func__, self->slsap_sel, self->dlsap_sel);
761 751
762 /* Already disconnected ? 752 /* Already disconnected ?
763 * There is a race condition between irlmp_disconnect_request() 753 * There is a race condition between irlmp_disconnect_request()
764 * and us that might mess up the hashbins below. This fixes it. 754 * and us that might mess up the hashbins below. This fixes it.
765 * Jean II */ 755 * Jean II */
766 if (! test_and_clear_bit(0, &self->connected)) { 756 if (! test_and_clear_bit(0, &self->connected)) {
767 IRDA_DEBUG(0, "%s(), already disconnected!\n", __func__); 757 pr_debug("%s(), already disconnected!\n", __func__);
768 return; 758 return;
769 } 759 }
770 760
@@ -797,7 +787,7 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
797 self->notify.disconnect_indication(self->notify.instance, 787 self->notify.disconnect_indication(self->notify.instance,
798 self, reason, skb); 788 self, reason, skb);
799 } else { 789 } else {
800 IRDA_DEBUG(0, "%s(), no handler\n", __func__); 790 pr_debug("%s(), no handler\n", __func__);
801 } 791 }
802} 792}
803 793
@@ -968,8 +958,6 @@ irlmp_notify_client(irlmp_client_t *client,
968 int number; /* Number of nodes in the log */ 958 int number; /* Number of nodes in the log */
969 int i; 959 int i;
970 960
971 IRDA_DEBUG(3, "%s()\n", __func__);
972
973 /* Check if client wants or not partial/selective log (optimisation) */ 961 /* Check if client wants or not partial/selective log (optimisation) */
974 if (!client->disco_callback) 962 if (!client->disco_callback)
975 return; 963 return;
@@ -1019,8 +1007,6 @@ void irlmp_discovery_confirm(hashbin_t *log, DISCOVERY_MODE mode)
1019 irlmp_client_t *client; 1007 irlmp_client_t *client;
1020 irlmp_client_t *client_next; 1008 irlmp_client_t *client_next;
1021 1009
1022 IRDA_DEBUG(3, "%s()\n", __func__);
1023
1024 IRDA_ASSERT(log != NULL, return;); 1010 IRDA_ASSERT(log != NULL, return;);
1025 1011
1026 if (!(HASHBIN_GET_SIZE(log))) 1012 if (!(HASHBIN_GET_SIZE(log)))
@@ -1054,8 +1040,6 @@ void irlmp_discovery_expiry(discinfo_t *expiries, int number)
1054 irlmp_client_t *client_next; 1040 irlmp_client_t *client_next;
1055 int i; 1041 int i;
1056 1042
1057 IRDA_DEBUG(3, "%s()\n", __func__);
1058
1059 IRDA_ASSERT(expiries != NULL, return;); 1043 IRDA_ASSERT(expiries != NULL, return;);
1060 1044
1061 /* For each client - notify callback may touch client list */ 1045 /* For each client - notify callback may touch client list */
@@ -1088,8 +1072,6 @@ void irlmp_discovery_expiry(discinfo_t *expiries, int number)
1088 */ 1072 */
1089discovery_t *irlmp_get_discovery_response(void) 1073discovery_t *irlmp_get_discovery_response(void)
1090{ 1074{
1091 IRDA_DEBUG(4, "%s()\n", __func__);
1092
1093 IRDA_ASSERT(irlmp != NULL, return NULL;); 1075 IRDA_ASSERT(irlmp != NULL, return NULL;);
1094 1076
1095 put_unaligned(irlmp->hints.word, (__u16 *)irlmp->discovery_rsp.data.hints); 1077 put_unaligned(irlmp->hints.word, (__u16 *)irlmp->discovery_rsp.data.hints);
@@ -1166,8 +1148,6 @@ int irlmp_udata_request(struct lsap_cb *self, struct sk_buff *userdata)
1166{ 1148{
1167 int ret; 1149 int ret;
1168 1150
1169 IRDA_DEBUG(4, "%s()\n", __func__);
1170
1171 IRDA_ASSERT(userdata != NULL, return -1;); 1151 IRDA_ASSERT(userdata != NULL, return -1;);
1172 1152
1173 /* Make room for MUX header */ 1153 /* Make room for MUX header */
@@ -1190,8 +1170,6 @@ int irlmp_udata_request(struct lsap_cb *self, struct sk_buff *userdata)
1190 */ 1170 */
1191void irlmp_udata_indication(struct lsap_cb *self, struct sk_buff *skb) 1171void irlmp_udata_indication(struct lsap_cb *self, struct sk_buff *skb)
1192{ 1172{
1193 IRDA_DEBUG(4, "%s()\n", __func__);
1194
1195 IRDA_ASSERT(self != NULL, return;); 1173 IRDA_ASSERT(self != NULL, return;);
1196 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;); 1174 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
1197 IRDA_ASSERT(skb != NULL, return;); 1175 IRDA_ASSERT(skb != NULL, return;);
@@ -1217,8 +1195,6 @@ int irlmp_connless_data_request(struct lsap_cb *self, struct sk_buff *userdata,
1217 struct sk_buff *clone_skb; 1195 struct sk_buff *clone_skb;
1218 struct lap_cb *lap; 1196 struct lap_cb *lap;
1219 1197
1220 IRDA_DEBUG(4, "%s()\n", __func__);
1221
1222 IRDA_ASSERT(userdata != NULL, return -1;); 1198 IRDA_ASSERT(userdata != NULL, return -1;);
1223 1199
1224 /* Make room for MUX and PID header */ 1200 /* Make room for MUX and PID header */
@@ -1268,8 +1244,6 @@ int irlmp_connless_data_request(struct lsap_cb *self, struct sk_buff *userdata,
1268#ifdef CONFIG_IRDA_ULTRA 1244#ifdef CONFIG_IRDA_ULTRA
1269void irlmp_connless_data_indication(struct lsap_cb *self, struct sk_buff *skb) 1245void irlmp_connless_data_indication(struct lsap_cb *self, struct sk_buff *skb)
1270{ 1246{
1271 IRDA_DEBUG(4, "%s()\n", __func__);
1272
1273 IRDA_ASSERT(self != NULL, return;); 1247 IRDA_ASSERT(self != NULL, return;);
1274 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;); 1248 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
1275 IRDA_ASSERT(skb != NULL, return;); 1249 IRDA_ASSERT(skb != NULL, return;);
@@ -1311,7 +1285,7 @@ void irlmp_status_indication(struct lap_cb *self,
1311 curr->notify.status_indication(curr->notify.instance, 1285 curr->notify.status_indication(curr->notify.instance,
1312 link, lock); 1286 link, lock);
1313 else 1287 else
1314 IRDA_DEBUG(2, "%s(), no handler\n", __func__); 1288 pr_debug("%s(), no handler\n", __func__);
1315 1289
1316 curr = next; 1290 curr = next;
1317 } 1291 }
@@ -1339,7 +1313,7 @@ void irlmp_flow_indication(struct lap_cb *self, LOCAL_FLOW flow)
1339 /* Get the number of lsap. That's the only safe way to know 1313 /* Get the number of lsap. That's the only safe way to know
1340 * that we have looped around... - Jean II */ 1314 * that we have looped around... - Jean II */
1341 lsap_todo = HASHBIN_GET_SIZE(self->lsaps); 1315 lsap_todo = HASHBIN_GET_SIZE(self->lsaps);
1342 IRDA_DEBUG(4, "%s() : %d lsaps to scan\n", __func__, lsap_todo); 1316 pr_debug("%s() : %d lsaps to scan\n", __func__, lsap_todo);
1343 1317
1344 /* Poll lsap in order until the queue is full or until we 1318 /* Poll lsap in order until the queue is full or until we
1345 * tried them all. 1319 * tried them all.
@@ -1358,14 +1332,16 @@ void irlmp_flow_indication(struct lap_cb *self, LOCAL_FLOW flow)
1358 /* Uh-oh... Paranoia */ 1332 /* Uh-oh... Paranoia */
1359 if(curr == NULL) 1333 if(curr == NULL)
1360 break; 1334 break;
1361 IRDA_DEBUG(4, "%s() : curr is %p, next was %p and is now %p, still %d to go - queue len = %d\n", __func__, curr, next, self->flow_next, lsap_todo, IRLAP_GET_TX_QUEUE_LEN(self->irlap)); 1335 pr_debug("%s() : curr is %p, next was %p and is now %p, still %d to go - queue len = %d\n",
1336 __func__, curr, next, self->flow_next, lsap_todo,
1337 IRLAP_GET_TX_QUEUE_LEN(self->irlap));
1362 1338
1363 /* Inform lsap user that it can send one more packet. */ 1339 /* Inform lsap user that it can send one more packet. */
1364 if (curr->notify.flow_indication != NULL) 1340 if (curr->notify.flow_indication != NULL)
1365 curr->notify.flow_indication(curr->notify.instance, 1341 curr->notify.flow_indication(curr->notify.instance,
1366 curr, flow); 1342 curr, flow);
1367 else 1343 else
1368 IRDA_DEBUG(1, "%s(), no handler\n", __func__); 1344 pr_debug("%s(), no handler\n", __func__);
1369 } 1345 }
1370} 1346}
1371 1347
@@ -1386,32 +1362,30 @@ __u8 *irlmp_hint_to_service(__u8 *hint)
1386 * since we currently only support 2 hint bytes 1362 * since we currently only support 2 hint bytes
1387 */ 1363 */
1388 service = kmalloc(16, GFP_ATOMIC); 1364 service = kmalloc(16, GFP_ATOMIC);
1389 if (!service) { 1365 if (!service)
1390 IRDA_DEBUG(1, "%s(), Unable to kmalloc!\n", __func__);
1391 return NULL; 1366 return NULL;
1392 }
1393 1367
1394 if (!hint[0]) { 1368 if (!hint[0]) {
1395 IRDA_DEBUG(1, "<None>\n"); 1369 pr_debug("<None>\n");
1396 kfree(service); 1370 kfree(service);
1397 return NULL; 1371 return NULL;
1398 } 1372 }
1399 if (hint[0] & HINT_PNP) 1373 if (hint[0] & HINT_PNP)
1400 IRDA_DEBUG(1, "PnP Compatible "); 1374 pr_debug("PnP Compatible ");
1401 if (hint[0] & HINT_PDA) 1375 if (hint[0] & HINT_PDA)
1402 IRDA_DEBUG(1, "PDA/Palmtop "); 1376 pr_debug("PDA/Palmtop ");
1403 if (hint[0] & HINT_COMPUTER) 1377 if (hint[0] & HINT_COMPUTER)
1404 IRDA_DEBUG(1, "Computer "); 1378 pr_debug("Computer ");
1405 if (hint[0] & HINT_PRINTER) { 1379 if (hint[0] & HINT_PRINTER) {
1406 IRDA_DEBUG(1, "Printer "); 1380 pr_debug("Printer ");
1407 service[i++] = S_PRINTER; 1381 service[i++] = S_PRINTER;
1408 } 1382 }
1409 if (hint[0] & HINT_MODEM) 1383 if (hint[0] & HINT_MODEM)
1410 IRDA_DEBUG(1, "Modem "); 1384 pr_debug("Modem ");
1411 if (hint[0] & HINT_FAX) 1385 if (hint[0] & HINT_FAX)
1412 IRDA_DEBUG(1, "Fax "); 1386 pr_debug("Fax ");
1413 if (hint[0] & HINT_LAN) { 1387 if (hint[0] & HINT_LAN) {
1414 IRDA_DEBUG(1, "LAN Access "); 1388 pr_debug("LAN Access ");
1415 service[i++] = S_LAN; 1389 service[i++] = S_LAN;
1416 } 1390 }
1417 /* 1391 /*
@@ -1421,22 +1395,22 @@ __u8 *irlmp_hint_to_service(__u8 *hint)
1421 */ 1395 */
1422 if (hint[0] & HINT_EXTENSION) { 1396 if (hint[0] & HINT_EXTENSION) {
1423 if (hint[1] & HINT_TELEPHONY) { 1397 if (hint[1] & HINT_TELEPHONY) {
1424 IRDA_DEBUG(1, "Telephony "); 1398 pr_debug("Telephony ");
1425 service[i++] = S_TELEPHONY; 1399 service[i++] = S_TELEPHONY;
1426 } 1400 }
1427 if (hint[1] & HINT_FILE_SERVER) 1401 if (hint[1] & HINT_FILE_SERVER)
1428 IRDA_DEBUG(1, "File Server "); 1402 pr_debug("File Server ");
1429 1403
1430 if (hint[1] & HINT_COMM) { 1404 if (hint[1] & HINT_COMM) {
1431 IRDA_DEBUG(1, "IrCOMM "); 1405 pr_debug("IrCOMM ");
1432 service[i++] = S_COMM; 1406 service[i++] = S_COMM;
1433 } 1407 }
1434 if (hint[1] & HINT_OBEX) { 1408 if (hint[1] & HINT_OBEX) {
1435 IRDA_DEBUG(1, "IrOBEX "); 1409 pr_debug("IrOBEX ");
1436 service[i++] = S_OBEX; 1410 service[i++] = S_OBEX;
1437 } 1411 }
1438 } 1412 }
1439 IRDA_DEBUG(1, "\n"); 1413 pr_debug("\n");
1440 1414
1441 /* So that client can be notified about any discovery */ 1415 /* So that client can be notified about any discovery */
1442 service[i++] = S_ANY; 1416 service[i++] = S_ANY;
@@ -1489,14 +1463,13 @@ void *irlmp_register_service(__u16 hints)
1489{ 1463{
1490 irlmp_service_t *service; 1464 irlmp_service_t *service;
1491 1465
1492 IRDA_DEBUG(4, "%s(), hints = %04x\n", __func__, hints); 1466 pr_debug("%s(), hints = %04x\n", __func__, hints);
1493 1467
1494 /* Make a new registration */ 1468 /* Make a new registration */
1495 service = kmalloc(sizeof(irlmp_service_t), GFP_ATOMIC); 1469 service = kmalloc(sizeof(irlmp_service_t), GFP_ATOMIC);
1496 if (!service) { 1470 if (!service)
1497 IRDA_DEBUG(1, "%s(), Unable to kmalloc!\n", __func__);
1498 return NULL; 1471 return NULL;
1499 } 1472
1500 service->hints.word = hints; 1473 service->hints.word = hints;
1501 hashbin_insert(irlmp->services, (irda_queue_t *) service, 1474 hashbin_insert(irlmp->services, (irda_queue_t *) service,
1502 (long) service, NULL); 1475 (long) service, NULL);
@@ -1519,15 +1492,13 @@ int irlmp_unregister_service(void *handle)
1519 irlmp_service_t *service; 1492 irlmp_service_t *service;
1520 unsigned long flags; 1493 unsigned long flags;
1521 1494
1522 IRDA_DEBUG(4, "%s()\n", __func__);
1523
1524 if (!handle) 1495 if (!handle)
1525 return -1; 1496 return -1;
1526 1497
1527 /* Caller may call with invalid handle (it's legal) - Jean II */ 1498 /* Caller may call with invalid handle (it's legal) - Jean II */
1528 service = hashbin_lock_find(irlmp->services, (long) handle, NULL); 1499 service = hashbin_lock_find(irlmp->services, (long) handle, NULL);
1529 if (!service) { 1500 if (!service) {
1530 IRDA_DEBUG(1, "%s(), Unknown service!\n", __func__); 1501 pr_debug("%s(), Unknown service!\n", __func__);
1531 return -1; 1502 return -1;
1532 } 1503 }
1533 1504
@@ -1564,15 +1535,12 @@ void *irlmp_register_client(__u16 hint_mask, DISCOVERY_CALLBACK1 disco_clb,
1564{ 1535{
1565 irlmp_client_t *client; 1536 irlmp_client_t *client;
1566 1537
1567 IRDA_DEBUG(1, "%s()\n", __func__);
1568 IRDA_ASSERT(irlmp != NULL, return NULL;); 1538 IRDA_ASSERT(irlmp != NULL, return NULL;);
1569 1539
1570 /* Make a new registration */ 1540 /* Make a new registration */
1571 client = kmalloc(sizeof(irlmp_client_t), GFP_ATOMIC); 1541 client = kmalloc(sizeof(irlmp_client_t), GFP_ATOMIC);
1572 if (!client) { 1542 if (!client)
1573 IRDA_DEBUG( 1, "%s(), Unable to kmalloc!\n", __func__);
1574 return NULL; 1543 return NULL;
1575 }
1576 1544
1577 /* Register the details */ 1545 /* Register the details */
1578 client->hint_mask.word = hint_mask; 1546 client->hint_mask.word = hint_mask;
@@ -1606,7 +1574,7 @@ int irlmp_update_client(void *handle, __u16 hint_mask,
1606 1574
1607 client = hashbin_lock_find(irlmp->clients, (long) handle, NULL); 1575 client = hashbin_lock_find(irlmp->clients, (long) handle, NULL);
1608 if (!client) { 1576 if (!client) {
1609 IRDA_DEBUG(1, "%s(), Unknown client!\n", __func__); 1577 pr_debug("%s(), Unknown client!\n", __func__);
1610 return -1; 1578 return -1;
1611 } 1579 }
1612 1580
@@ -1629,19 +1597,17 @@ int irlmp_unregister_client(void *handle)
1629{ 1597{
1630 struct irlmp_client *client; 1598 struct irlmp_client *client;
1631 1599
1632 IRDA_DEBUG(4, "%s()\n", __func__);
1633
1634 if (!handle) 1600 if (!handle)
1635 return -1; 1601 return -1;
1636 1602
1637 /* Caller may call with invalid handle (it's legal) - Jean II */ 1603 /* Caller may call with invalid handle (it's legal) - Jean II */
1638 client = hashbin_lock_find(irlmp->clients, (long) handle, NULL); 1604 client = hashbin_lock_find(irlmp->clients, (long) handle, NULL);
1639 if (!client) { 1605 if (!client) {
1640 IRDA_DEBUG(1, "%s(), Unknown client!\n", __func__); 1606 pr_debug("%s(), Unknown client!\n", __func__);
1641 return -1; 1607 return -1;
1642 } 1608 }
1643 1609
1644 IRDA_DEBUG(4, "%s(), removing client!\n", __func__); 1610 pr_debug("%s(), removing client!\n", __func__);
1645 hashbin_remove_this(irlmp->clients, (irda_queue_t *) client); 1611 hashbin_remove_this(irlmp->clients, (irda_queue_t *) client);
1646 kfree(client); 1612 kfree(client);
1647 1613
@@ -1670,8 +1636,6 @@ static int irlmp_slsap_inuse(__u8 slsap_sel)
1670 IRDA_ASSERT(irlmp->magic == LMP_MAGIC, return TRUE;); 1636 IRDA_ASSERT(irlmp->magic == LMP_MAGIC, return TRUE;);
1671 IRDA_ASSERT(slsap_sel != LSAP_ANY, return TRUE;); 1637 IRDA_ASSERT(slsap_sel != LSAP_ANY, return TRUE;);
1672 1638
1673 IRDA_DEBUG(4, "%s()\n", __func__);
1674
1675#ifdef CONFIG_IRDA_ULTRA 1639#ifdef CONFIG_IRDA_ULTRA
1676 /* Accept all bindings to the connectionless LSAP */ 1640 /* Accept all bindings to the connectionless LSAP */
1677 if (slsap_sel == LSAP_CONNLESS) 1641 if (slsap_sel == LSAP_CONNLESS)
@@ -1705,8 +1669,8 @@ static int irlmp_slsap_inuse(__u8 slsap_sel)
1705 goto errlsap;); 1669 goto errlsap;);
1706 1670
1707 if ((self->slsap_sel == slsap_sel)) { 1671 if ((self->slsap_sel == slsap_sel)) {
1708 IRDA_DEBUG(4, "Source LSAP selector=%02x in use\n", 1672 pr_debug("Source LSAP selector=%02x in use\n",
1709 self->slsap_sel); 1673 self->slsap_sel);
1710 goto errlsap; 1674 goto errlsap;
1711 } 1675 }
1712 self = (struct lsap_cb*) hashbin_get_next(lap->lsaps); 1676 self = (struct lsap_cb*) hashbin_get_next(lap->lsaps);
@@ -1730,8 +1694,8 @@ static int irlmp_slsap_inuse(__u8 slsap_sel)
1730 while (self != NULL) { 1694 while (self != NULL) {
1731 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, goto erruncon;); 1695 IRDA_ASSERT(self->magic == LMP_LSAP_MAGIC, goto erruncon;);
1732 if ((self->slsap_sel == slsap_sel)) { 1696 if ((self->slsap_sel == slsap_sel)) {
1733 IRDA_DEBUG(4, "Source LSAP selector=%02x in use (unconnected)\n", 1697 pr_debug("Source LSAP selector=%02x in use (unconnected)\n",
1734 self->slsap_sel); 1698 self->slsap_sel);
1735 goto erruncon; 1699 goto erruncon;
1736 } 1700 }
1737 self = (struct lsap_cb*) hashbin_get_next(irlmp->unconnected_lsaps); 1701 self = (struct lsap_cb*) hashbin_get_next(irlmp->unconnected_lsaps);
@@ -1811,8 +1775,8 @@ static __u8 irlmp_find_free_slsap(void)
1811 1775
1812 /* Got it ! */ 1776 /* Got it ! */
1813 lsap_sel = irlmp->last_lsap_sel; 1777 lsap_sel = irlmp->last_lsap_sel;
1814 IRDA_DEBUG(4, "%s(), found free lsap_sel=%02x\n", 1778 pr_debug("%s(), found free lsap_sel=%02x\n",
1815 __func__, lsap_sel); 1779 __func__, lsap_sel);
1816 1780
1817 return lsap_sel; 1781 return lsap_sel;
1818} 1782}
@@ -1830,26 +1794,27 @@ LM_REASON irlmp_convert_lap_reason( LAP_REASON lap_reason)
1830 1794
1831 switch (lap_reason) { 1795 switch (lap_reason) {
1832 case LAP_DISC_INDICATION: /* Received a disconnect request from peer */ 1796 case LAP_DISC_INDICATION: /* Received a disconnect request from peer */
1833 IRDA_DEBUG( 1, "%s(), LAP_DISC_INDICATION\n", __func__); 1797 pr_debug("%s(), LAP_DISC_INDICATION\n", __func__);
1834 reason = LM_USER_REQUEST; 1798 reason = LM_USER_REQUEST;
1835 break; 1799 break;
1836 case LAP_NO_RESPONSE: /* To many retransmits without response */ 1800 case LAP_NO_RESPONSE: /* To many retransmits without response */
1837 IRDA_DEBUG( 1, "%s(), LAP_NO_RESPONSE\n", __func__); 1801 pr_debug("%s(), LAP_NO_RESPONSE\n", __func__);
1838 reason = LM_LAP_DISCONNECT; 1802 reason = LM_LAP_DISCONNECT;
1839 break; 1803 break;
1840 case LAP_RESET_INDICATION: 1804 case LAP_RESET_INDICATION:
1841 IRDA_DEBUG( 1, "%s(), LAP_RESET_INDICATION\n", __func__); 1805 pr_debug("%s(), LAP_RESET_INDICATION\n", __func__);
1842 reason = LM_LAP_RESET; 1806 reason = LM_LAP_RESET;
1843 break; 1807 break;
1844 case LAP_FOUND_NONE: 1808 case LAP_FOUND_NONE:
1845 case LAP_MEDIA_BUSY: 1809 case LAP_MEDIA_BUSY:
1846 case LAP_PRIMARY_CONFLICT: 1810 case LAP_PRIMARY_CONFLICT:
1847 IRDA_DEBUG(1, "%s(), LAP_FOUND_NONE, LAP_MEDIA_BUSY or LAP_PRIMARY_CONFLICT\n", __func__); 1811 pr_debug("%s(), LAP_FOUND_NONE, LAP_MEDIA_BUSY or LAP_PRIMARY_CONFLICT\n",
1812 __func__);
1848 reason = LM_CONNECT_FAILURE; 1813 reason = LM_CONNECT_FAILURE;
1849 break; 1814 break;
1850 default: 1815 default:
1851 IRDA_DEBUG(1, "%s(), Unknown IrLAP disconnect reason %d!\n", 1816 pr_debug("%s(), Unknown IrLAP disconnect reason %d!\n",
1852 __func__, lap_reason); 1817 __func__, lap_reason);
1853 reason = LM_LAP_DISCONNECT; 1818 reason = LM_LAP_DISCONNECT;
1854 break; 1819 break;
1855 } 1820 }