aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bearer.c
diff options
context:
space:
mode:
authorErik Hugne <erik.hugne@ericsson.com>2012-06-29 00:16:37 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-07-13 19:24:44 -0400
commit2cf8aa19fe8bec578b707daa383ebff80e3f81a1 (patch)
treebd800510d0e01d441e25dd476228462106eaa9ea /net/tipc/bearer.c
parentf705ab956b3a0377181c9d73b235ad5bf4020937 (diff)
tipc: use standard printk shortcut macros (pr_err etc.)
All messages should go directly to the kernel log. The TIPC specific error, warning, info and debug trace macro's are removed and all references replaced with pr_err, pr_warn, pr_info and pr_debug. Commonly used sub-strings are explicitly declared as a const char to reduce .text size. Note that this means the debug messages (changed to pr_debug), are now enabled through dynamic debugging, instead of a TIPC specific Kconfig option (TIPC_DEBUG). The latter will be phased out completely Signed-off-by: Erik Hugne <erik.hugne@ericsson.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> [PG: use pr_fmt as suggested by Joe Perches <joe@perches.com>] Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/bearer.c')
-rw-r--r--net/tipc/bearer.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 86b703f55092..1840e1fadd2e 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -123,7 +123,7 @@ int tipc_register_media(struct tipc_media *m_ptr)
123exit: 123exit:
124 write_unlock_bh(&tipc_net_lock); 124 write_unlock_bh(&tipc_net_lock);
125 if (res) 125 if (res)
126 warn("Media <%s> registration error\n", m_ptr->name); 126 pr_warn("Media <%s> registration error\n", m_ptr->name);
127 return res; 127 return res;
128} 128}
129 129
@@ -418,12 +418,12 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
418 int res = -EINVAL; 418 int res = -EINVAL;
419 419
420 if (!tipc_own_addr) { 420 if (!tipc_own_addr) {
421 warn("Bearer <%s> rejected, not supported in standalone mode\n", 421 pr_warn("Bearer <%s> rejected, not supported in standalone mode\n",
422 name); 422 name);
423 return -ENOPROTOOPT; 423 return -ENOPROTOOPT;
424 } 424 }
425 if (!bearer_name_validate(name, &b_names)) { 425 if (!bearer_name_validate(name, &b_names)) {
426 warn("Bearer <%s> rejected, illegal name\n", name); 426 pr_warn("Bearer <%s> rejected, illegal name\n", name);
427 return -EINVAL; 427 return -EINVAL;
428 } 428 }
429 if (tipc_addr_domain_valid(disc_domain) && 429 if (tipc_addr_domain_valid(disc_domain) &&
@@ -435,12 +435,13 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
435 res = 0; /* accept specified node in own cluster */ 435 res = 0; /* accept specified node in own cluster */
436 } 436 }
437 if (res) { 437 if (res) {
438 warn("Bearer <%s> rejected, illegal discovery domain\n", name); 438 pr_warn("Bearer <%s> rejected, illegal discovery domain\n",
439 name);
439 return -EINVAL; 440 return -EINVAL;
440 } 441 }
441 if ((priority > TIPC_MAX_LINK_PRI) && 442 if ((priority > TIPC_MAX_LINK_PRI) &&
442 (priority != TIPC_MEDIA_LINK_PRI)) { 443 (priority != TIPC_MEDIA_LINK_PRI)) {
443 warn("Bearer <%s> rejected, illegal priority\n", name); 444 pr_warn("Bearer <%s> rejected, illegal priority\n", name);
444 return -EINVAL; 445 return -EINVAL;
445 } 446 }
446 447
@@ -448,8 +449,8 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
448 449
449 m_ptr = tipc_media_find(b_names.media_name); 450 m_ptr = tipc_media_find(b_names.media_name);
450 if (!m_ptr) { 451 if (!m_ptr) {
451 warn("Bearer <%s> rejected, media <%s> not registered\n", name, 452 pr_warn("Bearer <%s> rejected, media <%s> not registered\n",
452 b_names.media_name); 453 name, b_names.media_name);
453 goto exit; 454 goto exit;
454 } 455 }
455 456
@@ -465,24 +466,25 @@ restart:
465 continue; 466 continue;
466 } 467 }
467 if (!strcmp(name, tipc_bearers[i].name)) { 468 if (!strcmp(name, tipc_bearers[i].name)) {
468 warn("Bearer <%s> rejected, already enabled\n", name); 469 pr_warn("Bearer <%s> rejected, already enabled\n",
470 name);
469 goto exit; 471 goto exit;
470 } 472 }
471 if ((tipc_bearers[i].priority == priority) && 473 if ((tipc_bearers[i].priority == priority) &&
472 (++with_this_prio > 2)) { 474 (++with_this_prio > 2)) {
473 if (priority-- == 0) { 475 if (priority-- == 0) {
474 warn("Bearer <%s> rejected, duplicate priority\n", 476 pr_warn("Bearer <%s> rejected, duplicate priority\n",
475 name); 477 name);
476 goto exit; 478 goto exit;
477 } 479 }
478 warn("Bearer <%s> priority adjustment required %u->%u\n", 480 pr_warn("Bearer <%s> priority adjustment required %u->%u\n",
479 name, priority + 1, priority); 481 name, priority + 1, priority);
480 goto restart; 482 goto restart;
481 } 483 }
482 } 484 }
483 if (bearer_id >= MAX_BEARERS) { 485 if (bearer_id >= MAX_BEARERS) {
484 warn("Bearer <%s> rejected, bearer limit reached (%u)\n", 486 pr_warn("Bearer <%s> rejected, bearer limit reached (%u)\n",
485 name, MAX_BEARERS); 487 name, MAX_BEARERS);
486 goto exit; 488 goto exit;
487 } 489 }
488 490
@@ -490,7 +492,8 @@ restart:
490 strcpy(b_ptr->name, name); 492 strcpy(b_ptr->name, name);
491 res = m_ptr->enable_bearer(b_ptr); 493 res = m_ptr->enable_bearer(b_ptr);
492 if (res) { 494 if (res) {
493 warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res); 495 pr_warn("Bearer <%s> rejected, enable failure (%d)\n",
496 name, -res);
494 goto exit; 497 goto exit;
495 } 498 }
496 499
@@ -508,12 +511,13 @@ restart:
508 res = tipc_disc_create(b_ptr, &m_ptr->bcast_addr, disc_domain); 511 res = tipc_disc_create(b_ptr, &m_ptr->bcast_addr, disc_domain);
509 if (res) { 512 if (res) {
510 bearer_disable(b_ptr); 513 bearer_disable(b_ptr);
511 warn("Bearer <%s> rejected, discovery object creation failed\n", 514 pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
512 name); 515 name);
513 goto exit; 516 goto exit;
514 } 517 }
515 info("Enabled bearer <%s>, discovery domain %s, priority %u\n", 518 pr_info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
516 name, tipc_addr_string_fill(addr_string, disc_domain), priority); 519 name,
520 tipc_addr_string_fill(addr_string, disc_domain), priority);
517exit: 521exit:
518 write_unlock_bh(&tipc_net_lock); 522 write_unlock_bh(&tipc_net_lock);
519 return res; 523 return res;
@@ -531,12 +535,12 @@ int tipc_block_bearer(const char *name)
531 read_lock_bh(&tipc_net_lock); 535 read_lock_bh(&tipc_net_lock);
532 b_ptr = tipc_bearer_find(name); 536 b_ptr = tipc_bearer_find(name);
533 if (!b_ptr) { 537 if (!b_ptr) {
534 warn("Attempt to block unknown bearer <%s>\n", name); 538 pr_warn("Attempt to block unknown bearer <%s>\n", name);
535 read_unlock_bh(&tipc_net_lock); 539 read_unlock_bh(&tipc_net_lock);
536 return -EINVAL; 540 return -EINVAL;
537 } 541 }
538 542
539 info("Blocking bearer <%s>\n", name); 543 pr_info("Blocking bearer <%s>\n", name);
540 spin_lock_bh(&b_ptr->lock); 544 spin_lock_bh(&b_ptr->lock);
541 b_ptr->blocked = 1; 545 b_ptr->blocked = 1;
542 list_splice_init(&b_ptr->cong_links, &b_ptr->links); 546 list_splice_init(&b_ptr->cong_links, &b_ptr->links);
@@ -562,7 +566,7 @@ static void bearer_disable(struct tipc_bearer *b_ptr)
562 struct tipc_link *l_ptr; 566 struct tipc_link *l_ptr;
563 struct tipc_link *temp_l_ptr; 567 struct tipc_link *temp_l_ptr;
564 568
565 info("Disabling bearer <%s>\n", b_ptr->name); 569 pr_info("Disabling bearer <%s>\n", b_ptr->name);
566 spin_lock_bh(&b_ptr->lock); 570 spin_lock_bh(&b_ptr->lock);
567 b_ptr->blocked = 1; 571 b_ptr->blocked = 1;
568 b_ptr->media->disable_bearer(b_ptr); 572 b_ptr->media->disable_bearer(b_ptr);
@@ -584,7 +588,7 @@ int tipc_disable_bearer(const char *name)
584 write_lock_bh(&tipc_net_lock); 588 write_lock_bh(&tipc_net_lock);
585 b_ptr = tipc_bearer_find(name); 589 b_ptr = tipc_bearer_find(name);
586 if (b_ptr == NULL) { 590 if (b_ptr == NULL) {
587 warn("Attempt to disable unknown bearer <%s>\n", name); 591 pr_warn("Attempt to disable unknown bearer <%s>\n", name);
588 res = -EINVAL; 592 res = -EINVAL;
589 } else { 593 } else {
590 bearer_disable(b_ptr); 594 bearer_disable(b_ptr);