diff options
author | David S. Miller <davem@davemloft.net> | 2011-01-21 01:44:36 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-21 01:44:36 -0500 |
commit | b48f8c23c336d82c1af9a53187568bdb6e86b8a8 (patch) | |
tree | 0b85bd00081dee2dd410ec8e9f825eacf92223c2 /drivers | |
parent | d18046b3cd989c06d2ad8d615e57c3cf63c63b67 (diff) |
ppp: Clean up kernel log messages.
Use netdev_*() and pr_*().
To preserve existing semantics in cases where KERN_DEBUG is indeed
appropriate, use netdev_printk(KERN_DEBUG, ...)
Convert PPPIOCDETACH to pr_warn() because an unexpected file count is
a serious bug and should be logged with KERN_WARN.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ppp_generic.c | 86 |
1 files changed, 49 insertions, 37 deletions
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index c7a6c4466978..3d7a38eeacda 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -592,8 +592,8 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
592 | ppp_release(NULL, file); | 592 | ppp_release(NULL, file); |
593 | err = 0; | 593 | err = 0; |
594 | } else | 594 | } else |
595 | printk(KERN_DEBUG "PPPIOCDETACH file->f_count=%ld\n", | 595 | pr_warn("PPPIOCDETACH file->f_count=%ld\n", |
596 | atomic_long_read(&file->f_count)); | 596 | atomic_long_read(&file->f_count)); |
597 | mutex_unlock(&ppp_mutex); | 597 | mutex_unlock(&ppp_mutex); |
598 | return err; | 598 | return err; |
599 | } | 599 | } |
@@ -630,7 +630,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
630 | 630 | ||
631 | if (pf->kind != INTERFACE) { | 631 | if (pf->kind != INTERFACE) { |
632 | /* can't happen */ | 632 | /* can't happen */ |
633 | printk(KERN_ERR "PPP: not interface or channel??\n"); | 633 | pr_err("PPP: not interface or channel??\n"); |
634 | return -EINVAL; | 634 | return -EINVAL; |
635 | } | 635 | } |
636 | 636 | ||
@@ -704,7 +704,8 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
704 | } | 704 | } |
705 | vj = slhc_init(val2+1, val+1); | 705 | vj = slhc_init(val2+1, val+1); |
706 | if (!vj) { | 706 | if (!vj) { |
707 | printk(KERN_ERR "PPP: no memory (VJ compressor)\n"); | 707 | netdev_err(ppp->dev, |
708 | "PPP: no memory (VJ compressor)\n"); | ||
708 | err = -ENOMEM; | 709 | err = -ENOMEM; |
709 | break; | 710 | break; |
710 | } | 711 | } |
@@ -898,17 +899,17 @@ static int __init ppp_init(void) | |||
898 | { | 899 | { |
899 | int err; | 900 | int err; |
900 | 901 | ||
901 | printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n"); | 902 | pr_info("PPP generic driver version " PPP_VERSION "\n"); |
902 | 903 | ||
903 | err = register_pernet_device(&ppp_net_ops); | 904 | err = register_pernet_device(&ppp_net_ops); |
904 | if (err) { | 905 | if (err) { |
905 | printk(KERN_ERR "failed to register PPP pernet device (%d)\n", err); | 906 | pr_err("failed to register PPP pernet device (%d)\n", err); |
906 | goto out; | 907 | goto out; |
907 | } | 908 | } |
908 | 909 | ||
909 | err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops); | 910 | err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops); |
910 | if (err) { | 911 | if (err) { |
911 | printk(KERN_ERR "failed to register PPP device (%d)\n", err); | 912 | pr_err("failed to register PPP device (%d)\n", err); |
912 | goto out_net; | 913 | goto out_net; |
913 | } | 914 | } |
914 | 915 | ||
@@ -1078,7 +1079,7 @@ pad_compress_skb(struct ppp *ppp, struct sk_buff *skb) | |||
1078 | new_skb = alloc_skb(new_skb_size, GFP_ATOMIC); | 1079 | new_skb = alloc_skb(new_skb_size, GFP_ATOMIC); |
1079 | if (!new_skb) { | 1080 | if (!new_skb) { |
1080 | if (net_ratelimit()) | 1081 | if (net_ratelimit()) |
1081 | printk(KERN_ERR "PPP: no memory (comp pkt)\n"); | 1082 | netdev_err(ppp->dev, "PPP: no memory (comp pkt)\n"); |
1082 | return NULL; | 1083 | return NULL; |
1083 | } | 1084 | } |
1084 | if (ppp->dev->hard_header_len > PPP_HDRLEN) | 1085 | if (ppp->dev->hard_header_len > PPP_HDRLEN) |
@@ -1108,7 +1109,7 @@ pad_compress_skb(struct ppp *ppp, struct sk_buff *skb) | |||
1108 | * the same number. | 1109 | * the same number. |
1109 | */ | 1110 | */ |
1110 | if (net_ratelimit()) | 1111 | if (net_ratelimit()) |
1111 | printk(KERN_ERR "ppp: compressor dropped pkt\n"); | 1112 | netdev_err(ppp->dev, "ppp: compressor dropped pkt\n"); |
1112 | kfree_skb(skb); | 1113 | kfree_skb(skb); |
1113 | kfree_skb(new_skb); | 1114 | kfree_skb(new_skb); |
1114 | new_skb = NULL; | 1115 | new_skb = NULL; |
@@ -1138,7 +1139,9 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1138 | if (ppp->pass_filter && | 1139 | if (ppp->pass_filter && |
1139 | sk_run_filter(skb, ppp->pass_filter) == 0) { | 1140 | sk_run_filter(skb, ppp->pass_filter) == 0) { |
1140 | if (ppp->debug & 1) | 1141 | if (ppp->debug & 1) |
1141 | printk(KERN_DEBUG "PPP: outbound frame not passed\n"); | 1142 | netdev_printk(KERN_DEBUG, ppp->dev, |
1143 | "PPP: outbound frame " | ||
1144 | "not passed\n"); | ||
1142 | kfree_skb(skb); | 1145 | kfree_skb(skb); |
1143 | return; | 1146 | return; |
1144 | } | 1147 | } |
@@ -1164,7 +1167,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1164 | new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, | 1167 | new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, |
1165 | GFP_ATOMIC); | 1168 | GFP_ATOMIC); |
1166 | if (!new_skb) { | 1169 | if (!new_skb) { |
1167 | printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n"); | 1170 | netdev_err(ppp->dev, "PPP: no memory (VJ comp pkt)\n"); |
1168 | goto drop; | 1171 | goto drop; |
1169 | } | 1172 | } |
1170 | skb_reserve(new_skb, ppp->dev->hard_header_len - 2); | 1173 | skb_reserve(new_skb, ppp->dev->hard_header_len - 2); |
@@ -1202,7 +1205,9 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1202 | proto != PPP_LCP && proto != PPP_CCP) { | 1205 | proto != PPP_LCP && proto != PPP_CCP) { |
1203 | if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { | 1206 | if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { |
1204 | if (net_ratelimit()) | 1207 | if (net_ratelimit()) |
1205 | printk(KERN_ERR "ppp: compression required but down - pkt dropped.\n"); | 1208 | netdev_err(ppp->dev, |
1209 | "ppp: compression required but " | ||
1210 | "down - pkt dropped.\n"); | ||
1206 | goto drop; | 1211 | goto drop; |
1207 | } | 1212 | } |
1208 | skb = pad_compress_skb(ppp, skb); | 1213 | skb = pad_compress_skb(ppp, skb); |
@@ -1505,7 +1510,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1505 | noskb: | 1510 | noskb: |
1506 | spin_unlock_bh(&pch->downl); | 1511 | spin_unlock_bh(&pch->downl); |
1507 | if (ppp->debug & 1) | 1512 | if (ppp->debug & 1) |
1508 | printk(KERN_ERR "PPP: no memory (fragment)\n"); | 1513 | netdev_err(ppp->dev, "PPP: no memory (fragment)\n"); |
1509 | ++ppp->dev->stats.tx_errors; | 1514 | ++ppp->dev->stats.tx_errors; |
1510 | ++ppp->nxseq; | 1515 | ++ppp->nxseq; |
1511 | return 1; /* abandon the frame */ | 1516 | return 1; /* abandon the frame */ |
@@ -1686,7 +1691,8 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1686 | /* copy to a new sk_buff with more tailroom */ | 1691 | /* copy to a new sk_buff with more tailroom */ |
1687 | ns = dev_alloc_skb(skb->len + 128); | 1692 | ns = dev_alloc_skb(skb->len + 128); |
1688 | if (!ns) { | 1693 | if (!ns) { |
1689 | printk(KERN_ERR"PPP: no memory (VJ decomp)\n"); | 1694 | netdev_err(ppp->dev, "PPP: no memory " |
1695 | "(VJ decomp)\n"); | ||
1690 | goto err; | 1696 | goto err; |
1691 | } | 1697 | } |
1692 | skb_reserve(ns, 2); | 1698 | skb_reserve(ns, 2); |
@@ -1699,7 +1705,8 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1699 | 1705 | ||
1700 | len = slhc_uncompress(ppp->vj, skb->data + 2, skb->len - 2); | 1706 | len = slhc_uncompress(ppp->vj, skb->data + 2, skb->len - 2); |
1701 | if (len <= 0) { | 1707 | if (len <= 0) { |
1702 | printk(KERN_DEBUG "PPP: VJ decompression error\n"); | 1708 | netdev_printk(KERN_DEBUG, ppp->dev, |
1709 | "PPP: VJ decompression error\n"); | ||
1703 | goto err; | 1710 | goto err; |
1704 | } | 1711 | } |
1705 | len += 2; | 1712 | len += 2; |
@@ -1721,7 +1728,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1721 | goto err; | 1728 | goto err; |
1722 | 1729 | ||
1723 | if (slhc_remember(ppp->vj, skb->data + 2, skb->len - 2) <= 0) { | 1730 | if (slhc_remember(ppp->vj, skb->data + 2, skb->len - 2) <= 0) { |
1724 | printk(KERN_ERR "PPP: VJ uncompressed error\n"); | 1731 | netdev_err(ppp->dev, "PPP: VJ uncompressed error\n"); |
1725 | goto err; | 1732 | goto err; |
1726 | } | 1733 | } |
1727 | proto = PPP_IP; | 1734 | proto = PPP_IP; |
@@ -1762,8 +1769,9 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1762 | if (ppp->pass_filter && | 1769 | if (ppp->pass_filter && |
1763 | sk_run_filter(skb, ppp->pass_filter) == 0) { | 1770 | sk_run_filter(skb, ppp->pass_filter) == 0) { |
1764 | if (ppp->debug & 1) | 1771 | if (ppp->debug & 1) |
1765 | printk(KERN_DEBUG "PPP: inbound frame " | 1772 | netdev_printk(KERN_DEBUG, ppp->dev, |
1766 | "not passed\n"); | 1773 | "PPP: inbound frame " |
1774 | "not passed\n"); | ||
1767 | kfree_skb(skb); | 1775 | kfree_skb(skb); |
1768 | return; | 1776 | return; |
1769 | } | 1777 | } |
@@ -1821,7 +1829,8 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb) | |||
1821 | 1829 | ||
1822 | ns = dev_alloc_skb(obuff_size); | 1830 | ns = dev_alloc_skb(obuff_size); |
1823 | if (!ns) { | 1831 | if (!ns) { |
1824 | printk(KERN_ERR "ppp_decompress_frame: no memory\n"); | 1832 | netdev_err(ppp->dev, "ppp_decompress_frame: " |
1833 | "no memory\n"); | ||
1825 | goto err; | 1834 | goto err; |
1826 | } | 1835 | } |
1827 | /* the decompressor still expects the A/C bytes in the hdr */ | 1836 | /* the decompressor still expects the A/C bytes in the hdr */ |
@@ -2002,8 +2011,9 @@ ppp_mp_reconstruct(struct ppp *ppp) | |||
2002 | next = p->next; | 2011 | next = p->next; |
2003 | if (seq_before(PPP_MP_CB(p)->sequence, seq)) { | 2012 | if (seq_before(PPP_MP_CB(p)->sequence, seq)) { |
2004 | /* this can't happen, anyway ignore the skb */ | 2013 | /* this can't happen, anyway ignore the skb */ |
2005 | printk(KERN_ERR "ppp_mp_reconstruct bad seq %u < %u\n", | 2014 | netdev_err(ppp->dev, "ppp_mp_reconstruct bad " |
2006 | PPP_MP_CB(p)->sequence, seq); | 2015 | "seq %u < %u\n", |
2016 | PPP_MP_CB(p)->sequence, seq); | ||
2007 | head = next; | 2017 | head = next; |
2008 | continue; | 2018 | continue; |
2009 | } | 2019 | } |
@@ -2042,8 +2052,9 @@ ppp_mp_reconstruct(struct ppp *ppp) | |||
2042 | (PPP_MP_CB(head)->BEbits & B)) { | 2052 | (PPP_MP_CB(head)->BEbits & B)) { |
2043 | if (len > ppp->mrru + 2) { | 2053 | if (len > ppp->mrru + 2) { |
2044 | ++ppp->dev->stats.rx_length_errors; | 2054 | ++ppp->dev->stats.rx_length_errors; |
2045 | printk(KERN_DEBUG "PPP: reconstructed packet" | 2055 | netdev_printk(KERN_DEBUG, ppp->dev, |
2046 | " is too long (%d)\n", len); | 2056 | "PPP: reconstructed packet" |
2057 | " is too long (%d)\n", len); | ||
2047 | } else if (p == head) { | 2058 | } else if (p == head) { |
2048 | /* fragment is complete packet - reuse skb */ | 2059 | /* fragment is complete packet - reuse skb */ |
2049 | tail = p; | 2060 | tail = p; |
@@ -2051,8 +2062,9 @@ ppp_mp_reconstruct(struct ppp *ppp) | |||
2051 | break; | 2062 | break; |
2052 | } else if ((skb = dev_alloc_skb(len)) == NULL) { | 2063 | } else if ((skb = dev_alloc_skb(len)) == NULL) { |
2053 | ++ppp->dev->stats.rx_missed_errors; | 2064 | ++ppp->dev->stats.rx_missed_errors; |
2054 | printk(KERN_DEBUG "PPP: no memory for " | 2065 | netdev_printk(KERN_DEBUG, ppp->dev, |
2055 | "reconstructed packet"); | 2066 | "PPP: no memory for " |
2067 | "reconstructed packet"); | ||
2056 | } else { | 2068 | } else { |
2057 | tail = p; | 2069 | tail = p; |
2058 | break; | 2070 | break; |
@@ -2077,9 +2089,10 @@ ppp_mp_reconstruct(struct ppp *ppp) | |||
2077 | signal a receive error. */ | 2089 | signal a receive error. */ |
2078 | if (PPP_MP_CB(head)->sequence != ppp->nextseq) { | 2090 | if (PPP_MP_CB(head)->sequence != ppp->nextseq) { |
2079 | if (ppp->debug & 1) | 2091 | if (ppp->debug & 1) |
2080 | printk(KERN_DEBUG " missed pkts %u..%u\n", | 2092 | netdev_printk(KERN_DEBUG, ppp->dev, |
2081 | ppp->nextseq, | 2093 | " missed pkts %u..%u\n", |
2082 | PPP_MP_CB(head)->sequence-1); | 2094 | ppp->nextseq, |
2095 | PPP_MP_CB(head)->sequence-1); | ||
2083 | ++ppp->dev->stats.rx_dropped; | 2096 | ++ppp->dev->stats.rx_dropped; |
2084 | ppp_receive_error(ppp); | 2097 | ppp_receive_error(ppp); |
2085 | } | 2098 | } |
@@ -2617,8 +2630,8 @@ ppp_create_interface(struct net *net, int unit, int *retp) | |||
2617 | ret = register_netdev(dev); | 2630 | ret = register_netdev(dev); |
2618 | if (ret != 0) { | 2631 | if (ret != 0) { |
2619 | unit_put(&pn->units_idr, unit); | 2632 | unit_put(&pn->units_idr, unit); |
2620 | printk(KERN_ERR "PPP: couldn't register device %s (%d)\n", | 2633 | netdev_err(ppp->dev, "PPP: couldn't register device %s (%d)\n", |
2621 | dev->name, ret); | 2634 | dev->name, ret); |
2622 | goto out2; | 2635 | goto out2; |
2623 | } | 2636 | } |
2624 | 2637 | ||
@@ -2690,9 +2703,9 @@ static void ppp_destroy_interface(struct ppp *ppp) | |||
2690 | 2703 | ||
2691 | if (!ppp->file.dead || ppp->n_channels) { | 2704 | if (!ppp->file.dead || ppp->n_channels) { |
2692 | /* "can't happen" */ | 2705 | /* "can't happen" */ |
2693 | printk(KERN_ERR "ppp: destroying ppp struct %p but dead=%d " | 2706 | netdev_err(ppp->dev, "ppp: destroying ppp struct %p " |
2694 | "n_channels=%d !\n", ppp, ppp->file.dead, | 2707 | "but dead=%d n_channels=%d !\n", |
2695 | ppp->n_channels); | 2708 | ppp, ppp->file.dead, ppp->n_channels); |
2696 | return; | 2709 | return; |
2697 | } | 2710 | } |
2698 | 2711 | ||
@@ -2834,8 +2847,7 @@ static void ppp_destroy_channel(struct channel *pch) | |||
2834 | 2847 | ||
2835 | if (!pch->file.dead) { | 2848 | if (!pch->file.dead) { |
2836 | /* "can't happen" */ | 2849 | /* "can't happen" */ |
2837 | printk(KERN_ERR "ppp: destroying undead channel %p !\n", | 2850 | pr_err("ppp: destroying undead channel %p !\n", pch); |
2838 | pch); | ||
2839 | return; | 2851 | return; |
2840 | } | 2852 | } |
2841 | skb_queue_purge(&pch->file.xq); | 2853 | skb_queue_purge(&pch->file.xq); |
@@ -2847,7 +2859,7 @@ static void __exit ppp_cleanup(void) | |||
2847 | { | 2859 | { |
2848 | /* should never happen */ | 2860 | /* should never happen */ |
2849 | if (atomic_read(&ppp_unit_count) || atomic_read(&channel_count)) | 2861 | if (atomic_read(&ppp_unit_count) || atomic_read(&channel_count)) |
2850 | printk(KERN_ERR "PPP: removing module but units remain!\n"); | 2862 | pr_err("PPP: removing module but units remain!\n"); |
2851 | unregister_chrdev(PPP_MAJOR, "ppp"); | 2863 | unregister_chrdev(PPP_MAJOR, "ppp"); |
2852 | device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); | 2864 | device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); |
2853 | class_destroy(ppp_class); | 2865 | class_destroy(ppp_class); |
@@ -2865,7 +2877,7 @@ static int __unit_alloc(struct idr *p, void *ptr, int n) | |||
2865 | 2877 | ||
2866 | again: | 2878 | again: |
2867 | if (!idr_pre_get(p, GFP_KERNEL)) { | 2879 | if (!idr_pre_get(p, GFP_KERNEL)) { |
2868 | printk(KERN_ERR "PPP: No free memory for idr\n"); | 2880 | pr_err("PPP: No free memory for idr\n"); |
2869 | return -ENOMEM; | 2881 | return -ENOMEM; |
2870 | } | 2882 | } |
2871 | 2883 | ||