diff options
author | Joe Perches <joe@perches.com> | 2013-10-28 15:53:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-29 17:41:49 -0400 |
commit | 22ded57729e69974ce45643d65415c9983a168a8 (patch) | |
tree | 47d4323bbcfdf6cdc106a06e888b2fffa04990bb | |
parent | 7d1d65cb84e1cfacba3f54c5934194785259e0d8 (diff) |
netconsole: Convert to pr_<level>
Use a more current logging style.
Convert printks to pr_<level>.
Consolidate multiple printks into a single printk to avoid
any possible dmesg interleaving. Add a default "event" msg
in case the listed types are ever expanded.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/netconsole.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index adeee615dd19..a8ef4c4b94be 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -34,6 +34,8 @@ | |||
34 | * | 34 | * |
35 | ****************************************************************/ | 35 | ****************************************************************/ |
36 | 36 | ||
37 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
38 | |||
37 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
38 | #include <linux/init.h> | 40 | #include <linux/init.h> |
39 | #include <linux/module.h> | 41 | #include <linux/module.h> |
@@ -319,8 +321,8 @@ static ssize_t store_enabled(struct netconsole_target *nt, | |||
319 | if (enabled < 0 || enabled > 1) | 321 | if (enabled < 0 || enabled > 1) |
320 | return -EINVAL; | 322 | return -EINVAL; |
321 | if (enabled == nt->enabled) { | 323 | if (enabled == nt->enabled) { |
322 | printk(KERN_INFO "netconsole: network logging has already %s\n", | 324 | pr_info("network logging has already %s\n", |
323 | nt->enabled ? "started" : "stopped"); | 325 | nt->enabled ? "started" : "stopped"); |
324 | return -EINVAL; | 326 | return -EINVAL; |
325 | } | 327 | } |
326 | 328 | ||
@@ -339,7 +341,7 @@ static ssize_t store_enabled(struct netconsole_target *nt, | |||
339 | return err; | 341 | return err; |
340 | } | 342 | } |
341 | 343 | ||
342 | printk(KERN_INFO "netconsole: network logging started\n"); | 344 | pr_info("network logging started\n"); |
343 | 345 | ||
344 | } else { /* 0 */ | 346 | } else { /* 0 */ |
345 | netpoll_cleanup(&nt->np); | 347 | netpoll_cleanup(&nt->np); |
@@ -358,9 +360,8 @@ static ssize_t store_dev_name(struct netconsole_target *nt, | |||
358 | size_t len; | 360 | size_t len; |
359 | 361 | ||
360 | if (nt->enabled) { | 362 | if (nt->enabled) { |
361 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 363 | pr_err("target (%s) is enabled, disable to update parameters\n", |
362 | "disable to update parameters\n", | 364 | config_item_name(&nt->item)); |
363 | config_item_name(&nt->item)); | ||
364 | return -EINVAL; | 365 | return -EINVAL; |
365 | } | 366 | } |
366 | 367 | ||
@@ -381,9 +382,8 @@ static ssize_t store_local_port(struct netconsole_target *nt, | |||
381 | int rv; | 382 | int rv; |
382 | 383 | ||
383 | if (nt->enabled) { | 384 | if (nt->enabled) { |
384 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 385 | pr_err("target (%s) is enabled, disable to update parameters\n", |
385 | "disable to update parameters\n", | 386 | config_item_name(&nt->item)); |
386 | config_item_name(&nt->item)); | ||
387 | return -EINVAL; | 387 | return -EINVAL; |
388 | } | 388 | } |
389 | 389 | ||
@@ -400,9 +400,8 @@ static ssize_t store_remote_port(struct netconsole_target *nt, | |||
400 | int rv; | 400 | int rv; |
401 | 401 | ||
402 | if (nt->enabled) { | 402 | if (nt->enabled) { |
403 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 403 | pr_err("target (%s) is enabled, disable to update parameters\n", |
404 | "disable to update parameters\n", | 404 | config_item_name(&nt->item)); |
405 | config_item_name(&nt->item)); | ||
406 | return -EINVAL; | 405 | return -EINVAL; |
407 | } | 406 | } |
408 | 407 | ||
@@ -417,9 +416,8 @@ static ssize_t store_local_ip(struct netconsole_target *nt, | |||
417 | size_t count) | 416 | size_t count) |
418 | { | 417 | { |
419 | if (nt->enabled) { | 418 | if (nt->enabled) { |
420 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 419 | pr_err("target (%s) is enabled, disable to update parameters\n", |
421 | "disable to update parameters\n", | 420 | config_item_name(&nt->item)); |
422 | config_item_name(&nt->item)); | ||
423 | return -EINVAL; | 421 | return -EINVAL; |
424 | } | 422 | } |
425 | 423 | ||
@@ -427,7 +425,7 @@ static ssize_t store_local_ip(struct netconsole_target *nt, | |||
427 | const char *end; | 425 | const char *end; |
428 | if (in6_pton(buf, count, nt->np.local_ip.in6.s6_addr, -1, &end) > 0) { | 426 | if (in6_pton(buf, count, nt->np.local_ip.in6.s6_addr, -1, &end) > 0) { |
429 | if (*end && *end != '\n') { | 427 | if (*end && *end != '\n') { |
430 | printk(KERN_ERR "netconsole: invalid IPv6 address at: <%c>\n", *end); | 428 | pr_err("invalid IPv6 address at: <%c>\n", *end); |
431 | return -EINVAL; | 429 | return -EINVAL; |
432 | } | 430 | } |
433 | nt->np.ipv6 = true; | 431 | nt->np.ipv6 = true; |
@@ -448,9 +446,8 @@ static ssize_t store_remote_ip(struct netconsole_target *nt, | |||
448 | size_t count) | 446 | size_t count) |
449 | { | 447 | { |
450 | if (nt->enabled) { | 448 | if (nt->enabled) { |
451 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 449 | pr_err("target (%s) is enabled, disable to update parameters\n", |
452 | "disable to update parameters\n", | 450 | config_item_name(&nt->item)); |
453 | config_item_name(&nt->item)); | ||
454 | return -EINVAL; | 451 | return -EINVAL; |
455 | } | 452 | } |
456 | 453 | ||
@@ -458,7 +455,7 @@ static ssize_t store_remote_ip(struct netconsole_target *nt, | |||
458 | const char *end; | 455 | const char *end; |
459 | if (in6_pton(buf, count, nt->np.remote_ip.in6.s6_addr, -1, &end) > 0) { | 456 | if (in6_pton(buf, count, nt->np.remote_ip.in6.s6_addr, -1, &end) > 0) { |
460 | if (*end && *end != '\n') { | 457 | if (*end && *end != '\n') { |
461 | printk(KERN_ERR "netconsole: invalid IPv6 address at: <%c>\n", *end); | 458 | pr_err("invalid IPv6 address at: <%c>\n", *end); |
462 | return -EINVAL; | 459 | return -EINVAL; |
463 | } | 460 | } |
464 | nt->np.ipv6 = true; | 461 | nt->np.ipv6 = true; |
@@ -481,9 +478,8 @@ static ssize_t store_remote_mac(struct netconsole_target *nt, | |||
481 | u8 remote_mac[ETH_ALEN]; | 478 | u8 remote_mac[ETH_ALEN]; |
482 | 479 | ||
483 | if (nt->enabled) { | 480 | if (nt->enabled) { |
484 | printk(KERN_ERR "netconsole: target (%s) is enabled, " | 481 | pr_err("target (%s) is enabled, disable to update parameters\n", |
485 | "disable to update parameters\n", | 482 | config_item_name(&nt->item)); |
486 | config_item_name(&nt->item)); | ||
487 | return -EINVAL; | 483 | return -EINVAL; |
488 | } | 484 | } |
489 | 485 | ||
@@ -704,19 +700,20 @@ restart: | |||
704 | } | 700 | } |
705 | spin_unlock_irqrestore(&target_list_lock, flags); | 701 | spin_unlock_irqrestore(&target_list_lock, flags); |
706 | if (stopped) { | 702 | if (stopped) { |
707 | printk(KERN_INFO "netconsole: network logging stopped on " | 703 | const char *msg = "had an event"; |
708 | "interface %s as it ", dev->name); | ||
709 | switch (event) { | 704 | switch (event) { |
710 | case NETDEV_UNREGISTER: | 705 | case NETDEV_UNREGISTER: |
711 | printk(KERN_CONT "unregistered\n"); | 706 | msg = "unregistered"; |
712 | break; | 707 | break; |
713 | case NETDEV_RELEASE: | 708 | case NETDEV_RELEASE: |
714 | printk(KERN_CONT "released slaves\n"); | 709 | msg = "released slaves"; |
715 | break; | 710 | break; |
716 | case NETDEV_JOIN: | 711 | case NETDEV_JOIN: |
717 | printk(KERN_CONT "is joining a master device\n"); | 712 | msg = "is joining a master device"; |
718 | break; | 713 | break; |
719 | } | 714 | } |
715 | pr_info("network logging stopped on interface %s as it %s\n", | ||
716 | dev->name, msg); | ||
720 | } | 717 | } |
721 | 718 | ||
722 | done: | 719 | done: |
@@ -802,7 +799,7 @@ static int __init init_netconsole(void) | |||
802 | goto undonotifier; | 799 | goto undonotifier; |
803 | 800 | ||
804 | register_console(&netconsole); | 801 | register_console(&netconsole); |
805 | printk(KERN_INFO "netconsole: network logging started\n"); | 802 | pr_info("network logging started\n"); |
806 | 803 | ||
807 | return err; | 804 | return err; |
808 | 805 | ||
@@ -810,7 +807,7 @@ undonotifier: | |||
810 | unregister_netdevice_notifier(&netconsole_netdev_notifier); | 807 | unregister_netdevice_notifier(&netconsole_netdev_notifier); |
811 | 808 | ||
812 | fail: | 809 | fail: |
813 | printk(KERN_ERR "netconsole: cleaning up\n"); | 810 | pr_err("cleaning up\n"); |
814 | 811 | ||
815 | /* | 812 | /* |
816 | * Remove all targets and destroy them (only targets created | 813 | * Remove all targets and destroy them (only targets created |