aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/iriap.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/iriap.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/iriap.c')
-rw-r--r--net/irda/iriap.c91
1 files changed, 34 insertions, 57 deletions
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index c2ea3443f669..7a93cdd1ac31 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -145,7 +145,7 @@ int __init iriap_init(void)
145 */ 145 */
146 server = iriap_open(LSAP_IAS, IAS_SERVER, NULL, NULL); 146 server = iriap_open(LSAP_IAS, IAS_SERVER, NULL, NULL);
147 if (!server) { 147 if (!server) {
148 IRDA_DEBUG(0, "%s(), unable to open server\n", __func__); 148 pr_debug("%s(), unable to open server\n", __func__);
149 return -1; 149 return -1;
150 } 150 }
151 iriap_register_lsap(server, LSAP_IAS, IAS_SERVER); 151 iriap_register_lsap(server, LSAP_IAS, IAS_SERVER);
@@ -177,8 +177,6 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
177{ 177{
178 struct iriap_cb *self; 178 struct iriap_cb *self;
179 179
180 IRDA_DEBUG(2, "%s()\n", __func__);
181
182 self = kzalloc(sizeof(*self), GFP_ATOMIC); 180 self = kzalloc(sizeof(*self), GFP_ATOMIC);
183 if (!self) 181 if (!self)
184 return NULL; 182 return NULL;
@@ -221,8 +219,6 @@ EXPORT_SYMBOL(iriap_open);
221 */ 219 */
222static void __iriap_close(struct iriap_cb *self) 220static void __iriap_close(struct iriap_cb *self)
223{ 221{
224 IRDA_DEBUG(4, "%s()\n", __func__);
225
226 IRDA_ASSERT(self != NULL, return;); 222 IRDA_ASSERT(self != NULL, return;);
227 IRDA_ASSERT(self->magic == IAS_MAGIC, return;); 223 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
228 224
@@ -245,8 +241,6 @@ void iriap_close(struct iriap_cb *self)
245{ 241{
246 struct iriap_cb *entry; 242 struct iriap_cb *entry;
247 243
248 IRDA_DEBUG(2, "%s()\n", __func__);
249
250 IRDA_ASSERT(self != NULL, return;); 244 IRDA_ASSERT(self != NULL, return;);
251 IRDA_ASSERT(self->magic == IAS_MAGIC, return;); 245 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
252 246
@@ -266,8 +260,6 @@ static int iriap_register_lsap(struct iriap_cb *self, __u8 slsap_sel, int mode)
266{ 260{
267 notify_t notify; 261 notify_t notify;
268 262
269 IRDA_DEBUG(2, "%s()\n", __func__);
270
271 irda_notify_init(&notify); 263 irda_notify_init(&notify);
272 notify.connect_confirm = iriap_connect_confirm; 264 notify.connect_confirm = iriap_connect_confirm;
273 notify.connect_indication = iriap_connect_indication; 265 notify.connect_indication = iriap_connect_indication;
@@ -302,8 +294,8 @@ static void iriap_disconnect_indication(void *instance, void *sap,
302{ 294{
303 struct iriap_cb *self; 295 struct iriap_cb *self;
304 296
305 IRDA_DEBUG(4, "%s(), reason=%s [%d]\n", __func__, 297 pr_debug("%s(), reason=%s [%d]\n", __func__,
306 irlmp_reason_str(reason), reason); 298 irlmp_reason_str(reason), reason);
307 299
308 self = instance; 300 self = instance;
309 301
@@ -319,7 +311,7 @@ static void iriap_disconnect_indication(void *instance, void *sap,
319 dev_kfree_skb(skb); 311 dev_kfree_skb(skb);
320 312
321 if (self->mode == IAS_CLIENT) { 313 if (self->mode == IAS_CLIENT) {
322 IRDA_DEBUG(4, "%s(), disconnect as client\n", __func__); 314 pr_debug("%s(), disconnect as client\n", __func__);
323 315
324 316
325 iriap_do_client_event(self, IAP_LM_DISCONNECT_INDICATION, 317 iriap_do_client_event(self, IAP_LM_DISCONNECT_INDICATION,
@@ -332,7 +324,7 @@ static void iriap_disconnect_indication(void *instance, void *sap,
332 if (self->confirm) 324 if (self->confirm)
333 self->confirm(IAS_DISCONNECT, 0, NULL, self->priv); 325 self->confirm(IAS_DISCONNECT, 0, NULL, self->priv);
334 } else { 326 } else {
335 IRDA_DEBUG(4, "%s(), disconnect as server\n", __func__); 327 pr_debug("%s(), disconnect as server\n", __func__);
336 iriap_do_server_event(self, IAP_LM_DISCONNECT_INDICATION, 328 iriap_do_server_event(self, IAP_LM_DISCONNECT_INDICATION,
337 NULL); 329 NULL);
338 iriap_close(self); 330 iriap_close(self);
@@ -346,16 +338,13 @@ static void iriap_disconnect_request(struct iriap_cb *self)
346{ 338{
347 struct sk_buff *tx_skb; 339 struct sk_buff *tx_skb;
348 340
349 IRDA_DEBUG(4, "%s()\n", __func__);
350
351 IRDA_ASSERT(self != NULL, return;); 341 IRDA_ASSERT(self != NULL, return;);
352 IRDA_ASSERT(self->magic == IAS_MAGIC, return;); 342 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
353 343
354 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); 344 tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
355 if (tx_skb == NULL) { 345 if (tx_skb == NULL) {
356 IRDA_DEBUG(0, 346 pr_debug("%s(), Could not allocate an sk_buff of length %d\n",
357 "%s(), Could not allocate an sk_buff of length %d\n", 347 __func__, LMP_MAX_HEADER);
358 __func__, LMP_MAX_HEADER);
359 return; 348 return;
360 } 349 }
361 350
@@ -460,14 +449,14 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self,
460 len = get_unaligned_be16(fp + n); 449 len = get_unaligned_be16(fp + n);
461 n += 2; 450 n += 2;
462 451
463 IRDA_DEBUG(4, "%s(), len=%d\n", __func__, len); 452 pr_debug("%s(), len=%d\n", __func__, len);
464 453
465 /* Get object ID, MSB first */ 454 /* Get object ID, MSB first */
466 obj_id = get_unaligned_be16(fp + n); 455 obj_id = get_unaligned_be16(fp + n);
467 n += 2; 456 n += 2;
468 457
469 type = fp[n++]; 458 type = fp[n++];
470 IRDA_DEBUG(4, "%s(), Value type = %d\n", __func__, type); 459 pr_debug("%s(), Value type = %d\n", __func__, type);
471 460
472 switch (type) { 461 switch (type) {
473 case IAS_INTEGER: 462 case IAS_INTEGER:
@@ -476,7 +465,7 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self,
476 value = irias_new_integer_value(tmp_cpu32); 465 value = irias_new_integer_value(tmp_cpu32);
477 466
478 /* Legal values restricted to 0x01-0x6f, page 15 irttp */ 467 /* Legal values restricted to 0x01-0x6f, page 15 irttp */
479 IRDA_DEBUG(4, "%s(), lsap=%d\n", __func__, value->t.integer); 468 pr_debug("%s(), lsap=%d\n", __func__, value->t.integer);
480 break; 469 break;
481 case IAS_STRING: 470 case IAS_STRING:
482 charset = fp[n++]; 471 charset = fp[n++];
@@ -495,11 +484,11 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self,
495/* case CS_ISO_8859_9: */ 484/* case CS_ISO_8859_9: */
496/* case CS_UNICODE: */ 485/* case CS_UNICODE: */
497 default: 486 default:
498 IRDA_DEBUG(0, "%s(), charset [%d] %s, not supported\n", 487 pr_debug("%s(), charset [%d] %s, not supported\n",
499 __func__, charset, 488 __func__, charset,
500 charset < ARRAY_SIZE(ias_charset_types) ? 489 charset < ARRAY_SIZE(ias_charset_types) ?
501 ias_charset_types[charset] : 490 ias_charset_types[charset] :
502 "(unknown)"); 491 "(unknown)");
503 492
504 /* Aborting, close connection! */ 493 /* Aborting, close connection! */
505 iriap_disconnect_request(self); 494 iriap_disconnect_request(self);
@@ -507,12 +496,12 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self,
507 /* break; */ 496 /* break; */
508 } 497 }
509 value_len = fp[n++]; 498 value_len = fp[n++];
510 IRDA_DEBUG(4, "%s(), strlen=%d\n", __func__, value_len); 499 pr_debug("%s(), strlen=%d\n", __func__, value_len);
511 500
512 /* Make sure the string is null-terminated */ 501 /* Make sure the string is null-terminated */
513 if (n + value_len < skb->len) 502 if (n + value_len < skb->len)
514 fp[n + value_len] = 0x00; 503 fp[n + value_len] = 0x00;
515 IRDA_DEBUG(4, "Got string %s\n", fp+n); 504 pr_debug("Got string %s\n", fp+n);
516 505
517 /* Will truncate to IAS_MAX_STRING bytes */ 506 /* Will truncate to IAS_MAX_STRING bytes */
518 value = irias_new_string_value(fp+n); 507 value = irias_new_string_value(fp+n);
@@ -538,7 +527,7 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self,
538 if (self->confirm) 527 if (self->confirm)
539 self->confirm(IAS_SUCCESS, obj_id, value, self->priv); 528 self->confirm(IAS_SUCCESS, obj_id, value, self->priv);
540 else { 529 else {
541 IRDA_DEBUG(0, "%s(), missing handler!\n", __func__); 530 pr_debug("%s(), missing handler!\n", __func__);
542 irias_delete_value(value); 531 irias_delete_value(value);
543 } 532 }
544} 533}
@@ -560,8 +549,6 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self,
560 __be16 tmp_be16; 549 __be16 tmp_be16;
561 __u8 *fp; 550 __u8 *fp;
562 551
563 IRDA_DEBUG(4, "%s()\n", __func__);
564
565 IRDA_ASSERT(self != NULL, return;); 552 IRDA_ASSERT(self != NULL, return;);
566 IRDA_ASSERT(self->magic == IAS_MAGIC, return;); 553 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
567 IRDA_ASSERT(value != NULL, return;); 554 IRDA_ASSERT(value != NULL, return;);
@@ -622,12 +609,12 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self,
622 memcpy(fp+n, value->t.oct_seq, value->len); n+=value->len; 609 memcpy(fp+n, value->t.oct_seq, value->len); n+=value->len;
623 break; 610 break;
624 case IAS_MISSING: 611 case IAS_MISSING:
625 IRDA_DEBUG( 3, "%s: sending IAS_MISSING\n", __func__); 612 pr_debug("%s: sending IAS_MISSING\n", __func__);
626 skb_put(tx_skb, 1); 613 skb_put(tx_skb, 1);
627 fp[n++] = value->type; 614 fp[n++] = value->type;
628 break; 615 break;
629 default: 616 default:
630 IRDA_DEBUG(0, "%s(), type not implemented!\n", __func__); 617 pr_debug("%s(), type not implemented!\n", __func__);
631 break; 618 break;
632 } 619 }
633 iriap_do_r_connect_event(self, IAP_CALL_RESPONSE, tx_skb); 620 iriap_do_r_connect_event(self, IAP_CALL_RESPONSE, tx_skb);
@@ -654,8 +641,6 @@ static void iriap_getvaluebyclass_indication(struct iriap_cb *self,
654 __u8 *fp; 641 __u8 *fp;
655 int n; 642 int n;
656 643
657 IRDA_DEBUG(4, "%s()\n", __func__);
658
659 IRDA_ASSERT(self != NULL, return;); 644 IRDA_ASSERT(self != NULL, return;);
660 IRDA_ASSERT(self->magic == IAS_MAGIC, return;); 645 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
661 IRDA_ASSERT(skb != NULL, return;); 646 IRDA_ASSERT(skb != NULL, return;);
@@ -677,20 +662,20 @@ static void iriap_getvaluebyclass_indication(struct iriap_cb *self,
677 memcpy(attr, fp+n, attr_len); n+=attr_len; 662 memcpy(attr, fp+n, attr_len); n+=attr_len;
678 attr[attr_len] = '\0'; 663 attr[attr_len] = '\0';
679 664
680 IRDA_DEBUG(4, "LM-IAS: Looking up %s: %s\n", name, attr); 665 pr_debug("LM-IAS: Looking up %s: %s\n", name, attr);
681 obj = irias_find_object(name); 666 obj = irias_find_object(name);
682 667
683 if (obj == NULL) { 668 if (obj == NULL) {
684 IRDA_DEBUG(2, "LM-IAS: Object %s not found\n", name); 669 pr_debug("LM-IAS: Object %s not found\n", name);
685 iriap_getvaluebyclass_response(self, 0x1235, IAS_CLASS_UNKNOWN, 670 iriap_getvaluebyclass_response(self, 0x1235, IAS_CLASS_UNKNOWN,
686 &irias_missing); 671 &irias_missing);
687 return; 672 return;
688 } 673 }
689 IRDA_DEBUG(4, "LM-IAS: found %s, id=%d\n", obj->name, obj->id); 674 pr_debug("LM-IAS: found %s, id=%d\n", obj->name, obj->id);
690 675
691 attrib = irias_find_attrib(obj, attr); 676 attrib = irias_find_attrib(obj, attr);
692 if (attrib == NULL) { 677 if (attrib == NULL) {
693 IRDA_DEBUG(2, "LM-IAS: Attribute %s not found\n", attr); 678 pr_debug("LM-IAS: Attribute %s not found\n", attr);
694 iriap_getvaluebyclass_response(self, obj->id, 679 iriap_getvaluebyclass_response(self, obj->id,
695 IAS_ATTRIB_UNKNOWN, 680 IAS_ATTRIB_UNKNOWN,
696 &irias_missing); 681 &irias_missing);
@@ -713,8 +698,6 @@ void iriap_send_ack(struct iriap_cb *self)
713 struct sk_buff *tx_skb; 698 struct sk_buff *tx_skb;
714 __u8 *frame; 699 __u8 *frame;
715 700
716 IRDA_DEBUG(2, "%s()\n", __func__);
717
718 IRDA_ASSERT(self != NULL, return;); 701 IRDA_ASSERT(self != NULL, return;);
719 IRDA_ASSERT(self->magic == IAS_MAGIC, return;); 702 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
720 703
@@ -744,7 +727,7 @@ void iriap_connect_request(struct iriap_cb *self)
744 self->saddr, self->daddr, 727 self->saddr, self->daddr,
745 NULL, NULL); 728 NULL, NULL);
746 if (ret < 0) { 729 if (ret < 0) {
747 IRDA_DEBUG(0, "%s(), connect failed!\n", __func__); 730 pr_debug("%s(), connect failed!\n", __func__);
748 self->confirm(IAS_DISCONNECT, 0, NULL, self->priv); 731 self->confirm(IAS_DISCONNECT, 0, NULL, self->priv);
749 } 732 }
750} 733}
@@ -792,8 +775,6 @@ static void iriap_connect_indication(void *instance, void *sap,
792{ 775{
793 struct iriap_cb *self, *new; 776 struct iriap_cb *self, *new;
794 777
795 IRDA_DEBUG(1, "%s()\n", __func__);
796
797 self = instance; 778 self = instance;
798 779
799 IRDA_ASSERT(skb != NULL, return;); 780 IRDA_ASSERT(skb != NULL, return;);
@@ -803,14 +784,14 @@ static void iriap_connect_indication(void *instance, void *sap,
803 /* Start new server */ 784 /* Start new server */
804 new = iriap_open(LSAP_IAS, IAS_SERVER, NULL, NULL); 785 new = iriap_open(LSAP_IAS, IAS_SERVER, NULL, NULL);
805 if (!new) { 786 if (!new) {
806 IRDA_DEBUG(0, "%s(), open failed\n", __func__); 787 pr_debug("%s(), open failed\n", __func__);
807 goto out; 788 goto out;
808 } 789 }
809 790
810 /* Now attach up the new "socket" */ 791 /* Now attach up the new "socket" */
811 new->lsap = irlmp_dup(self->lsap, new); 792 new->lsap = irlmp_dup(self->lsap, new);
812 if (!new->lsap) { 793 if (!new->lsap) {
813 IRDA_DEBUG(0, "%s(), dup failed!\n", __func__); 794 pr_debug("%s(), dup failed!\n", __func__);
814 goto out; 795 goto out;
815 } 796 }
816 797
@@ -840,8 +821,6 @@ static int iriap_data_indication(void *instance, void *sap,
840 __u8 *frame; 821 __u8 *frame;
841 __u8 opcode; 822 __u8 opcode;
842 823
843 IRDA_DEBUG(3, "%s()\n", __func__);
844
845 self = instance; 824 self = instance;
846 825
847 IRDA_ASSERT(skb != NULL, return 0;); 826 IRDA_ASSERT(skb != NULL, return 0;);
@@ -852,7 +831,7 @@ static int iriap_data_indication(void *instance, void *sap,
852 831
853 if (self->mode == IAS_SERVER) { 832 if (self->mode == IAS_SERVER) {
854 /* Call server */ 833 /* Call server */
855 IRDA_DEBUG(4, "%s(), Calling server!\n", __func__); 834 pr_debug("%s(), Calling server!\n", __func__);
856 iriap_do_r_connect_event(self, IAP_RECV_F_LST, skb); 835 iriap_do_r_connect_event(self, IAP_RECV_F_LST, skb);
857 goto out; 836 goto out;
858 } 837 }
@@ -865,7 +844,7 @@ static int iriap_data_indication(void *instance, void *sap,
865 844
866 /* Check for ack frames since they don't contain any data */ 845 /* Check for ack frames since they don't contain any data */
867 if (opcode & IAP_ACK) { 846 if (opcode & IAP_ACK) {
868 IRDA_DEBUG(0, "%s() Got ack frame!\n", __func__); 847 pr_debug("%s() Got ack frame!\n", __func__);
869 goto out; 848 goto out;
870 } 849 }
871 850
@@ -873,7 +852,7 @@ static int iriap_data_indication(void *instance, void *sap,
873 852
874 switch (opcode) { 853 switch (opcode) {
875 case GET_INFO_BASE: 854 case GET_INFO_BASE:
876 IRDA_DEBUG(0, "IrLMP GetInfoBaseDetails not implemented!\n"); 855 pr_debug("IrLMP GetInfoBaseDetails not implemented!\n");
877 break; 856 break;
878 case GET_VALUE_BY_CLASS: 857 case GET_VALUE_BY_CLASS:
879 iriap_do_call_event(self, IAP_RECV_F_LST, NULL); 858 iriap_do_call_event(self, IAP_RECV_F_LST, NULL);
@@ -883,7 +862,7 @@ static int iriap_data_indication(void *instance, void *sap,
883 iriap_getvaluebyclass_confirm(self, skb); 862 iriap_getvaluebyclass_confirm(self, skb);
884 break; 863 break;
885 case IAS_CLASS_UNKNOWN: 864 case IAS_CLASS_UNKNOWN:
886 IRDA_DEBUG(1, "%s(), No such class!\n", __func__); 865 pr_debug("%s(), No such class!\n", __func__);
887 /* Finished, close connection! */ 866 /* Finished, close connection! */
888 iriap_disconnect_request(self); 867 iriap_disconnect_request(self);
889 868
@@ -896,7 +875,7 @@ static int iriap_data_indication(void *instance, void *sap,
896 self->priv); 875 self->priv);
897 break; 876 break;
898 case IAS_ATTRIB_UNKNOWN: 877 case IAS_ATTRIB_UNKNOWN:
899 IRDA_DEBUG(1, "%s(), No such attribute!\n", __func__); 878 pr_debug("%s(), No such attribute!\n", __func__);
900 /* Finished, close connection! */ 879 /* Finished, close connection! */
901 iriap_disconnect_request(self); 880 iriap_disconnect_request(self);
902 881
@@ -911,8 +890,8 @@ static int iriap_data_indication(void *instance, void *sap,
911 } 890 }
912 break; 891 break;
913 default: 892 default:
914 IRDA_DEBUG(0, "%s(), Unknown op-code: %02x\n", __func__, 893 pr_debug("%s(), Unknown op-code: %02x\n", __func__,
915 opcode); 894 opcode);
916 break; 895 break;
917 } 896 }
918 897
@@ -933,8 +912,6 @@ void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb)
933 __u8 *fp; 912 __u8 *fp;
934 __u8 opcode; 913 __u8 opcode;
935 914
936 IRDA_DEBUG(4, "%s()\n", __func__);
937
938 IRDA_ASSERT(self != NULL, return;); 915 IRDA_ASSERT(self != NULL, return;);
939 IRDA_ASSERT(self->magic == IAS_MAGIC, return;); 916 IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
940 IRDA_ASSERT(skb != NULL, return;); 917 IRDA_ASSERT(skb != NULL, return;);