x25: convert printks to pr_<level>
Subsystems (3)
PATCH 1/1 x25: convert printks to pr_<level>
use pr_<level> instead of printk(LEVEL)
--- net/x25/af_x25.c | 2 +- net/x25/x25_dev.c | 8 ++++---- net/x25/x25_facilities.c | 12 ++++++------ net/x25/x25_forward.c | 2 +- net/x25/x25_in.c | 2 +- net/x25/x25_link.c | 4 ++-- net/x25/x25_subr.c | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-)
net/x25/af_x25.c +1 -1
@@ -1809,7 +1809,7 @@ static int __init x25_init(void)if (rc !=0 ) goto out_sock; -printk (KERN_INFO "X.25 for Linux Version 0.2\n" ); +pr_info ("X.25 for Linux Version 0.2\n" );x25_register_sysctl (); rc =x25_proc_init ();
net/x25/x25_dev.c +4 -4
@@ -89,7 +89,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)*/ if (frametype !=X25_CLEAR_CONFIRMATION ) -printk (KERN_DEBUG "x25_receive_data(): unknown frame type %2x\n" ,frametype); +pr_debug ("x25_receive_data(): unknown frame type %2x\n" ,frametype);return 0 ; }
@@ -114,7 +114,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,*/ nb =x25_get_neigh (dev);if (!nb) { -printk (KERN_DEBUG "X.25: unknown neighbour - %s\n" , dev->name); +pr_debug ("X.25: unknown neighbour - %s\n" , dev->name); goto drop; }
@@ -154,7 +154,7 @@ void x25_establish_link(struct x25_neigh *nb)switch (nb->dev->type) {case ARPHRD_X25 :if ((skb =alloc_skb (1 ,GFP_ATOMIC )) ==NULL ) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; } ptr =skb_put (skb,1 );
@@ -189,7 +189,7 @@ void x25_terminate_link(struct x25_neigh *nb) skb =alloc_skb (1 ,GFP_ATOMIC );if (!skb) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; }
net/x25/x25_facilities.c +6 -6
@@ -109,7 +109,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_MARKER :break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("X.25: unknown facility " "%02X, value %02X\n" , p[0 ], p[1 ]);break ;
@@ -132,7 +132,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_WINDOW_SIZE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("X.25: unknown facility " "%02X, values %02X, %02X\n" , p[0 ], p[1 ], p[2 ]);break ;
@@ -143,7 +143,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_FAC_CLASS_C :if (len <4 )return -1 ; -printk (KERN_DEBUG "X.25: unknown facility %02X, " +pr_debug ("X.25: unknown facility %02X, " "values %02X, %02X, %02X\n" , p[0 ], p[1 ], p[2 ], p[3 ]); p +=4 ;
@@ -172,7 +172,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_CALLED_AE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility %02X," +pr_debug ("X.25: unknown facility %02X," "length %d\n" , p[0 ], p[1 ]);break ; }
@@ -341,12 +341,12 @@ void x25_limit_facilities(struct x25_facilities *facilities,if (!nb->extended) {if (facilities->winsize_in >7 ) { -printk (KERN_DEBUG "X.25: incoming winsize limited to 7\n" ); +pr_debug ("X.25: incoming winsize limited to 7\n" ); facilities->winsize_in =7 ; }if (facilities->winsize_out >7 ) { facilities->winsize_out =7 ; -printk (KERN_DEBUG "X.25: outgoing winsize limited to 7\n" ); +pr_debug ("X.25: outgoing winsize limited to 7\n" ); } } }
net/x25/x25_forward.c +1 -1
@@ -51,7 +51,7 @@ int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,list_for_each (entry, &x25_forward_list) { x25_frwd = list_entry(entry, struct x25_forward, node);if (x25_frwd->lci == lci) { -printk (KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n" ); +pr_warn ("X.25: call request for lci which is already registered!, transmitting but not registering new pair\n" ); same_lci =1 ; } }
net/x25/x25_in.c +1 -1
@@ -317,7 +317,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametypbreak ;default : -printk (KERN_WARNING "x25: unknown %02X in state 3\n" , frametype); +pr_warn ("x25: unknown %02X in state 3\n" , frametype);break ; }
net/x25/x25_link.c +2 -2
@@ -93,13 +93,13 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *nb,if (!pskb_may_pull (skb,X25_STD_MIN_LEN +4 ))break ; -printk (KERN_WARNING "x25: diagnostic #%d - %02X %02X %02X\n" , +pr_warn ("x25: diagnostic #%d - %02X %02X %02X\n" , skb->data[3 ], skb->data[4 ], skb->data[5 ], skb->data[6 ]);break ;default : -printk (KERN_WARNING "x25: received unknown %02X with LCI 000\n" , +pr_warn ("x25: received unknown %02X with LCI 000\n" , frametype);break ; }
net/x25/x25_subr.c +2 -2
@@ -148,7 +148,7 @@ void x25_write_internal(struct sock *sk, int frametype)case X25_RESET_CONFIRMATION :break ;default : -printk (KERN_ERR "X.25: invalid frame type %02X\n" , frametype); +pr_err ("X.25: invalid frame type %02X\n" , frametype);return ; }
@@ -338,7 +338,7 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, } } -printk (KERN_DEBUG "X.25: invalid PLP frame %02X %02X %02X\n" , +pr_debug ("X.25: invalid PLP frame %02X %02X %02X\n" , frame[0 ], frame[1 ], frame[2 ]);return X25_ILLEGAL ;
Signature · 1 line
1.7.12
Quoted 1 line · Wang Weidong
use pr_<level> instead of printk(LEVEL)
Consider adding
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
or
#define pr_fmt(fmt) "X25: " fmt
to each of these files before any #include
and removing the leading "X25: " in each of
the formats.
Quoted 11 lines · Joe Perches
Quoted 1 line · Wang Weidong
use pr_<level> instead of printk(LEVEL)
Consider adding
#definepr_fmt(fmt)KBUILD_MODNAME": " fmt
or
#definepr_fmt(fmt)"X25: " fmt
to each of these files before any #include
and removing the leading "X25: " in each of
the formats.
Thanks for your suggestions. I will fix it in v2.
Regards.
Quoted 4 lines
Quoted 181 lines · Wang Weidong
use pr_<level> instead of printk(LEVEL)
Signed-off-by Wang Weidong <[email protected]>--- net/x25/af_x25.c | 2 +- net/x25/x25_dev.c | 8 ++++---- net/x25/x25_facilities.c | 12 ++++++------ net/x25/x25_forward.c | 2 +- net/x25/x25_in.c | 2 +- net/x25/x25_link.c | 4 ++-- net/x25/x25_subr.c | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-)net/x25/af_x25.c +1
-1@@ -1809,7 +1809,7 @@ static int __init x25_init(void)if (rc !=0 ) goto out_sock; -printk (KERN_INFO "X.25 for Linux Version 0.2\n" ); +pr_info ("X.25 for Linux Version 0.2\n" );x25_register_sysctl (); rc =x25_proc_init ();net/x25/x25_dev.c +4
-4@@ -89,7 +89,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)*/ if (frametype !=X25_CLEAR_CONFIRMATION ) -printk (KERN_DEBUG "x25_receive_data(): unknown frame type %2x\n" ,frametype); +pr_debug ("x25_receive_data(): unknown frame type %2x\n" ,frametype);return 0 ; }@@ -114,7 +114,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,*/ nb =x25_get_neigh (dev);if (!nb) { -printk (KERN_DEBUG "X.25: unknown neighbour - %s\n" , dev->name); +pr_debug ("X.25: unknown neighbour - %s\n" , dev->name); goto drop; }@@ -154,7 +154,7 @@ void x25_establish_link(struct x25_neigh *nb)switch (nb->dev->type) {case ARPHRD_X25 :if ((skb =alloc_skb (1 ,GFP_ATOMIC )) ==NULL ) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; } ptr =skb_put (skb,1 );@@ -189,7 +189,7 @@ void x25_terminate_link(struct x25_neigh *nb) skb =alloc_skb (1 ,GFP_ATOMIC );if (!skb) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; }net/x25/x25_facilities.c +6
-6@@ -109,7 +109,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_MARKER :break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("X.25: unknown facility " "%02X, value %02X\n" , p[0 ], p[1 ]);break ;@@ -132,7 +132,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_WINDOW_SIZE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("X.25: unknown facility " "%02X, values %02X, %02X\n" , p[0 ], p[1 ], p[2 ]);break ;@@ -143,7 +143,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_FAC_CLASS_C :if (len <4 )return -1 ; -printk (KERN_DEBUG "X.25: unknown facility %02X, " +pr_debug ("X.25: unknown facility %02X, " "values %02X, %02X, %02X\n" , p[0 ], p[1 ], p[2 ], p[3 ]); p +=4 ;@@ -172,7 +172,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_CALLED_AE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility %02X," +pr_debug ("X.25: unknown facility %02X," "length %d\n" , p[0 ], p[1 ]);break ; }@@ -341,12 +341,12 @@ void x25_limit_facilities(struct x25_facilities *facilities,if (!nb->extended) {if (facilities->winsize_in >7 ) { -printk (KERN_DEBUG "X.25: incoming winsize limited to 7\n" ); +pr_debug ("X.25: incoming winsize limited to 7\n" ); facilities->winsize_in =7 ; }if (facilities->winsize_out >7 ) { facilities->winsize_out =7 ; -printk (KERN_DEBUG "X.25: outgoing winsize limited to 7\n" ); +pr_debug ("X.25: outgoing winsize limited to 7\n" ); } } }net/x25/x25_forward.c +1
-1@@ -51,7 +51,7 @@ int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,list_for_each (entry, &x25_forward_list) { x25_frwd = list_entry(entry, struct x25_forward, node);if (x25_frwd->lci == lci) { -printk (KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n" ); +pr_warn ("X.25: call request for lci which is already registered!, transmitting but not registering new pair\n" ); same_lci =1 ; } }net/x25/x25_in.c +1
-1@@ -317,7 +317,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametypbreak ;default : -printk (KERN_WARNING "x25: unknown %02X in state 3\n" , frametype); +pr_warn ("x25: unknown %02X in state 3\n" , frametype);break ; }net/x25/x25_link.c +2
-2@@ -93,13 +93,13 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *nb,if (!pskb_may_pull (skb,X25_STD_MIN_LEN +4 ))break ; -printk (KERN_WARNING "x25: diagnostic #%d - %02X %02X %02X\n" , +pr_warn ("x25: diagnostic #%d - %02X %02X %02X\n" , skb->data[3 ], skb->data[4 ], skb->data[5 ], skb->data[6 ]);break ;default : -printk (KERN_WARNING "x25: received unknown %02X with LCI 000\n" , +pr_warn ("x25: received unknown %02X with LCI 000\n" , frametype);break ; }net/x25/x25_subr.c +1
-1@@ -148,7 +148,7 @@ void x25_write_internal(struct sock *sk, int frametype)case X25_RESET_CONFIRMATION :break ;default : -printk (KERN_ERR "X.25: invalid frame type %02X\n" , frametype); +pr_err ("X.25: invalid frame type %02X\n" , frametype);return ; }
net/x25/x25_subr.c int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, · line 344
Quoted 8 lines
net/x25/x25_subr.c +1
-1@@ -338,7 +338,7 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, } } -printk (KERN_DEBUG "X.25: invalid PLP frame %02X %02X %02X\n" , +pr_debug ("X.25: invalid PLP frame %02X %02X %02X\n" , frame[0 ], frame[1 ], frame[2 ]);return X25_ILLEGAL ;
I just wonder why we need to change? What's your reason and isn't OK for now?
regards,
Yi
Quoted 169 lines · Yi Li
Quoted 167 lines · Wang Weidong
use pr_<level> instead of printk(LEVEL)
Signed-off-by Wang Weidong <[email protected]>--- net/x25/af_x25.c | 2 +- net/x25/x25_dev.c | 8 ++++---- net/x25/x25_facilities.c | 12 ++++++------ net/x25/x25_forward.c | 2 +- net/x25/x25_in.c | 2 +- net/x25/x25_link.c | 4 ++-- net/x25/x25_subr.c | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-)net/x25/af_x25.c +1
-0@@ -1809,7 +1809,7 @@ static int __init x25_init(void)if (rc !=0 ) goto out_sock; -printk (KERN_INFO "X.25 for Linux Version 0.2\n" ); +pr_info ("X.25 for Linux Version 0.2\n" );x25_register_sysctl (); rc =x25_proc_init ();net/x25/x25_dev.c +2
-2@@ -89,7 +89,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)*/ if (frametype !=X25_CLEAR_CONFIRMATION ) -printk (KERN_DEBUG "x25_receive_data(): unknown frame type %2x\n" ,frametype); +pr_debug ("x25_receive_data(): unknown frame type %2x\n" ,frametype);return 0 ; }@@ -114,7 +114,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,*/ nb =x25_get_neigh (dev);if (!nb) { -printk (KERN_DEBUG "X.25: unknown neighbour - %s\n" , dev->name); +pr_debug ("X.25: unknown neighbour - %s\n" , dev->name); goto drop; } @@ -154,7 +154,7 @@ void x25_establish_link(struct x25_neigh *nb)switch (nb->dev->type) { case ARPHRD_X25: if ((skb = alloc_skb(1, GFP_ATOMIC)) == NULL) {net/x25/x25_dev.c +2
-2-printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; } ptr =skb_put (skb,1 );@@ -189,7 +189,7 @@ void x25_terminate_link(struct x25_neigh *nb) skb =alloc_skb (1 ,GFP_ATOMIC );if (!skb) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; } diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.cindex b825325..a4c2a2a 100644
net/x25/x25_facilities.c +6
-6@@ -109,7 +109,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_MARKER :break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("X.25: unknown facility " "%02X, value %02X\n" , p[0 ], p[1 ]);break ;@@ -132,7 +132,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_WINDOW_SIZE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("X.25: unknown facility " "%02X, values %02X, %02X\n" , p[0 ], p[1 ], p[2 ]);break ;@@ -143,7 +143,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_FAC_CLASS_C :if (len <4 )return -1 ; -printk (KERN_DEBUG "X.25: unknown facility %02X, " +pr_debug ("X.25: unknown facility %02X, " "values %02X, %02X, %02X\n" , p[0 ], p[1 ], p[2 ], p[3 ]); p +=4 ;@@ -172,7 +172,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_CALLED_AE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility %02X," +pr_debug ("X.25: unknown facility %02X," "length %d\n" , p[0 ], p[1 ]);break ; }@@ -341,12 +341,12 @@ void x25_limit_facilities(struct x25_facilities *facilities,if (!nb->extended) {if (facilities->winsize_in >7 ) { -printk (KERN_DEBUG "X.25: incoming winsize limited to 7\n" ); +pr_debug ("X.25: incoming winsize limited to 7\n" ); facilities->winsize_in =7 ; }if (facilities->winsize_out >7 ) { facilities->winsize_out =7 ; -printk (KERN_DEBUG "X.25: outgoing winsize limited to 7\n" ); +pr_debug ("X.25: outgoing winsize limited to 7\n" ); } } }net/x25/x25_forward.c +1
-1@@ -51,7 +51,7 @@ int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,list_for_each (entry, &x25_forward_list) { x25_frwd = list_entry(entry, struct x25_forward, node);if (x25_frwd->lci == lci) { -printk (KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n" ); +pr_warn ("X.25: call request for lci which is already registered!, transmitting but not registering new pair\n" ); same_lci =1 ; } }net/x25/x25_in.c +1
-1@@ -317,7 +317,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametypbreak ;default : -printk (KERN_WARNING "x25: unknown %02X in state 3\n" , frametype); +pr_warn ("x25: unknown %02X in state 3\n" , frametype);break ; } diff --git a/net/x25/x25_link.c b/net/x25/x25_link.cindex 4acacf3..b5f44d3 100644
net/x25/x25_link.c +2
-1@@ -93,13 +93,13 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *nb,if (!pskb_may_pull (skb,X25_STD_MIN_LEN +4 ))break ; -printk (KERN_WARNING "x25: diagnostic #%d - %02X %02X %02X\n" , +pr_warn ("x25: diagnostic #%d - %02X %02X %02X\n" , skb->data[3 ], skb->data[4 ], skb->data[5], skb->data[6]);break ;default : -printk (KERN_WARNING "x25: received unknown %02X with LCI 000\n" , +pr_warn ("x25: received unknown %02X with LCI 000\n" , frametype);break ; }net/x25/x25_subr.c +1
-1@@ -148,7 +148,7 @@ void x25_write_internal(struct sock *sk, int frametype)case X25_RESET_CONFIRMATION :break ;default : -printk (KERN_ERR "X.25: invalid frame type %02X\n" , frametype); +pr_err ("X.25: invalid frame type %02X\n" , frametype);return ; }
Quoted 9 lines
Quoted 7 lines
net/x25/x25_subr.c +0
-0@@ -338,7 +338,7 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q,} } - printk(KERN_DEBUG "X.25: invalid PLP frame %02X %02X %02X\n", + pr_debug("X.25: invalid PLP frame %02X %02X %02X\n", frame[0], frame[1], frame[2]); return X25_ILLEGAL;I just wonder why we need to change? What's your reason and isn't OK for now?
Yes, it is OK for now.
I think the use of pr_<level> is preferred to printk, although it just a macro replace.
Quoted 11 lines
regards,
YiSignature · 5 lines
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html .
PATCH v2 1/1 x25: convert printks to pr_<level>
In reply to Wang Weidonguse pr_<level> instead of printk(LEVEL)
--- net/x25/af_x25.c | 4 +++- net/x25/x25_dev.c | 11 +++++++---- net/x25/x25_facilities.c | 15 +++++++++------ net/x25/x25_forward.c | 5 ++++- net/x25/x25_in.c | 4 +++- net/x25/x25_link.c | 6 ++++-- net/x25/x25_subr.c | 7 +++++-- 7 files changed, 35 insertions(+), 17 deletions(-)
net/x25/af_x25.c +3 -1
@@ -35,6 +35,8 @@* response */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/module.h> #include <linux/capability.h> #include <linux/errno.h>
@@ -1809,7 +1811,7 @@ static int __init x25_init(void)if (rc !=0 ) goto out_sock; -printk (KERN_INFO "X.25 for Linux Version 0.2\n" ); +pr_info ("Linux Version 0.2\n" );x25_register_sysctl (); rc =x25_proc_init ();
net/x25/x25_dev.c +7 -4
@@ -17,6 +17,9 @@* 2000-09-04 Henner Eisen Prevent freeing a dangling skb. */ +#define pr_fmt (fmt) "X25: " fmt +#define DEBUG +#include <linux/kernel.h> #include <linux/netdevice.h> #include <linux/skbuff.h>
@@ -89,7 +92,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)*/ if (frametype !=X25_CLEAR_CONFIRMATION ) -printk (KERN_DEBUG "x25_receive_data(): unknown frame type %2x\n" ,frametype); +pr_debug ("x25_receive_data(): unknown frame type %2x\n" ,frametype);return 0 ; }
@@ -114,7 +117,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,*/ nb =x25_get_neigh (dev);if (!nb) { -printk (KERN_DEBUG "X.25: unknown neighbour - %s\n" , dev->name); +pr_debug ("unknown neighbour - %s\n" , dev->name); goto drop; }
@@ -154,7 +157,7 @@ void x25_establish_link(struct x25_neigh *nb)switch (nb->dev->type) {case ARPHRD_X25 :if ((skb =alloc_skb (1 ,GFP_ATOMIC )) ==NULL ) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; } ptr =skb_put (skb,1 );
@@ -189,7 +192,7 @@ void x25_terminate_link(struct x25_neigh *nb) skb =alloc_skb (1 ,GFP_ATOMIC );if (!skb) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; }
net/x25/x25_facilities.c +9 -6
@@ -21,6 +21,9 @@* on response. */ +#define pr_fmt (fmt) "X25: " fmt +#define DEBUG +#include <linux/kernel.h> #include <linux/string.h> #include <linux/skbuff.h>
@@ -109,7 +112,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_MARKER :break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("unknown facility " "%02X, value %02X\n" , p[0 ], p[1 ]);break ;
@@ -132,7 +135,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_WINDOW_SIZE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("unknown facility " "%02X, values %02X, %02X\n" , p[0 ], p[1 ], p[2 ]);break ;
@@ -143,7 +146,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_FAC_CLASS_C :if (len <4 )return -1 ; -printk (KERN_DEBUG "X.25: unknown facility %02X, " +pr_debug ("unknown facility %02X, " "values %02X, %02X, %02X\n" , p[0 ], p[1 ], p[2 ], p[3 ]); p +=4 ;
@@ -172,7 +175,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_CALLED_AE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility %02X," +pr_debug ("unknown facility %02X," "length %d\n" , p[0 ], p[1 ]);break ; }
@@ -341,12 +344,12 @@ void x25_limit_facilities(struct x25_facilities *facilities,if (!nb->extended) {if (facilities->winsize_in >7 ) { -printk (KERN_DEBUG "X.25: incoming winsize limited to 7\n" ); +pr_debug ("incoming winsize limited to 7\n" ); facilities->winsize_in =7 ; }if (facilities->winsize_out >7 ) { facilities->winsize_out =7 ; -printk (KERN_DEBUG "X.25: outgoing winsize limited to 7\n" ); +pr_debug ("outgoing winsize limited to 7\n" ); } } }
net/x25/x25_forward.c +4 -1
@@ -8,6 +8,9 @@* History * 03-01-2007 Added forwarding for x.25 Andrew Hendry */ + +#define pr_fmt (fmt) "X25: " fmt +#include <linux/if_arp.h> #include <linux/init.h> #include <linux/slab.h>
@@ -51,7 +54,7 @@ int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,list_for_each (entry, &x25_forward_list) { x25_frwd = list_entry(entry, struct x25_forward, node);if (x25_frwd->lci == lci) { -printk (KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n" ); +pr_warn ("call request for lci which is already registered!, transmitting but not registering new pair\n" ); same_lci =1 ; } }
net/x25/x25_in.c +3 -1
@@ -23,6 +23,8 @@* i-frames. */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/slab.h> #include <linux/errno.h> #include <linux/kernel.h>
@@ -317,7 +319,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametypbreak ;default : -printk (KERN_WARNING "x25: unknown %02X in state 3\n" , frametype); +pr_warn ("unknown %02X in state 3\n" , frametype);break ; }
net/x25/x25_link.c +4 -2
@@ -21,6 +21,8 @@* 2000-09-04 Henner Eisen dev_hold() / dev_put() for x25_neigh. */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/kernel.h> #include <linux/jiffies.h> #include <linux/timer.h>
@@ -93,13 +95,13 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *nb,if (!pskb_may_pull (skb,X25_STD_MIN_LEN +4 ))break ; -printk (KERN_WARNING "x25: diagnostic #%d - %02X %02X %02X\n" , +pr_warn ("diagnostic #%d - %02X %02X %02X\n" , skb->data[3 ], skb->data[4 ], skb->data[5 ], skb->data[6 ]);break ;default : -printk (KERN_WARNING "x25: received unknown %02X with LCI 000\n" , +pr_warn ("received unknown %02X with LCI 000\n" , frametype);break ; }
net/x25/x25_subr.c +5 -2
@@ -23,6 +23,9 @@* restriction on response. */ +#define pr_fmt (fmt) "X25: " fmt +#define DEBUG +#include <linux/slab.h> #include <linux/kernel.h> #include <linux/string.h>
@@ -148,7 +151,7 @@ void x25_write_internal(struct sock *sk, int frametype)case X25_RESET_CONFIRMATION :break ;default : -printk (KERN_ERR "X.25: invalid frame type %02X\n" , frametype); +pr_err ("invalid frame type %02X\n" , frametype);return ; }
@@ -338,7 +341,7 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, } } -printk (KERN_DEBUG "X.25: invalid PLP frame %02X %02X %02X\n" , +pr_debug ("invalid PLP frame %02X %02X %02X\n" , frame[0 ], frame[1 ], frame[2 ]);return X25_ILLEGAL ;
Signature · 1 line
1.7.12
Quoted 250 lines · Wang Weidong
use pr_<level> instead of printk(LEVEL)
Suggested-by Joe Perches <[email protected]>Signed-off-by Wang Weidong <[email protected]>--- net/x25/af_x25.c | 4 +++- net/x25/x25_dev.c | 11 +++++++---- net/x25/x25_facilities.c | 15 +++++++++------ net/x25/x25_forward.c | 5 ++++- net/x25/x25_in.c | 4 +++- net/x25/x25_link.c | 6 ++++-- net/x25/x25_subr.c | 7 +++++-- 7 files changed, 35 insertions(+), 17 deletions(-)net/x25/af_x25.c +3
-1@@ -35,6 +35,8 @@* response */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/module.h> #include <linux/capability.h> #include <linux/errno.h> @@ -1809,7 +1811,7 @@ static int __init x25_init(void)if (rc !=0 ) goto out_sock; -printk (KERN_INFO "X.25 for Linux Version 0.2\n" ); +pr_info ("Linux Version 0.2\n" );x25_register_sysctl (); rc =x25_proc_init ();net/x25/x25_dev.c +7
-4@@ -17,6 +17,9 @@* 2000-09-04 Henner Eisen Prevent freeing a dangling skb. */ +#define pr_fmt (fmt) "X25: " fmt +#define DEBUG +#include <linux/kernel.h> #include <linux/netdevice.h> #include <linux/skbuff.h> @@ -89,7 +92,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)*/ if (frametype !=X25_CLEAR_CONFIRMATION ) -printk (KERN_DEBUG "x25_receive_data(): unknown frame type %2x\n" ,frametype); +pr_debug ("x25_receive_data(): unknown frame type %2x\n" ,frametype);return 0 ; }@@ -114,7 +117,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,*/ nb =x25_get_neigh (dev);if (!nb) { -printk (KERN_DEBUG "X.25: unknown neighbour - %s\n" , dev->name); +pr_debug ("unknown neighbour - %s\n" , dev->name); goto drop; }@@ -154,7 +157,7 @@ void x25_establish_link(struct x25_neigh *nb)switch (nb->dev->type) {case ARPHRD_X25 :if ((skb =alloc_skb (1 ,GFP_ATOMIC )) ==NULL ) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; } ptr =skb_put (skb,1 );@@ -189,7 +192,7 @@ void x25_terminate_link(struct x25_neigh *nb) skb =alloc_skb (1 ,GFP_ATOMIC );if (!skb) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; }net/x25/x25_facilities.c +9
-6@@ -21,6 +21,9 @@* on response. */ +#define pr_fmt (fmt) "X25: " fmt +#define DEBUG +#include <linux/kernel.h> #include <linux/string.h> #include <linux/skbuff.h> @@ -109,7 +112,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_MARKER :break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("unknown facility " "%02X, value %02X\n" , p[0 ], p[1 ]);break ;@@ -132,7 +135,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_WINDOW_SIZE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("unknown facility " "%02X, values %02X, %02X\n" , p[0 ], p[1 ], p[2 ]);break ;@@ -143,7 +146,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_FAC_CLASS_C :if (len <4 )return -1 ; -printk (KERN_DEBUG "X.25: unknown facility %02X, " +pr_debug ("unknown facility %02X, " "values %02X, %02X, %02X\n" , p[0 ], p[1 ], p[2 ], p[3 ]); p +=4 ;@@ -172,7 +175,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_CALLED_AE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility %02X," +pr_debug ("unknown facility %02X," "length %d\n" , p[0 ], p[1 ]);break ; }@@ -341,12 +344,12 @@ void x25_limit_facilities(struct x25_facilities *facilities,if (!nb->extended) {if (facilities->winsize_in >7 ) { -printk (KERN_DEBUG "X.25: incoming winsize limited to 7\n" ); +pr_debug ("incoming winsize limited to 7\n" ); facilities->winsize_in =7 ; }if (facilities->winsize_out >7 ) { facilities->winsize_out =7 ; -printk (KERN_DEBUG "X.25: outgoing winsize limited to 7\n" ); +pr_debug ("outgoing winsize limited to 7\n" ); } } }net/x25/x25_forward.c +4
-1@@ -8,6 +8,9 @@* History * 03-01-2007 Added forwarding for x.25 Andrew Hendry */ + +#define pr_fmt (fmt) "X25: " fmt +#include <linux/if_arp.h> #include <linux/init.h> #include <linux/slab.h> @@ -51,7 +54,7 @@ int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,list_for_each (entry, &x25_forward_list) { x25_frwd = list_entry(entry, struct x25_forward, node);if (x25_frwd->lci == lci) { -printk (KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n" ); +pr_warn ("call request for lci which is already registered!, transmitting but not registering new pair\n" ); same_lci =1 ; } }net/x25/x25_in.c +3
-1@@ -23,6 +23,8 @@* i-frames. */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/slab.h> #include <linux/errno.h> #include <linux/kernel.h> @@ -317,7 +319,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametypbreak ;default : -printk (KERN_WARNING "x25: unknown %02X in state 3\n" , frametype); +pr_warn ("unknown %02X in state 3\n" , frametype);break ; }net/x25/x25_link.c +4
-2@@ -21,6 +21,8 @@* 2000-09-04 Henner Eisen dev_hold() / dev_put() for x25_neigh. */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/kernel.h> #include <linux/jiffies.h> #include <linux/timer.h> @@ -93,13 +95,13 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *nb,if (!pskb_may_pull (skb,X25_STD_MIN_LEN +4 ))break ; -printk (KERN_WARNING "x25: diagnostic #%d - %02X %02X %02X\n" , +pr_warn ("diagnostic #%d - %02X %02X %02X\n" , skb->data[3 ], skb->data[4 ], skb->data[5 ], skb->data[6 ]);break ;default : -printk (KERN_WARNING "x25: received unknown %02X with LCI 000\n" , +pr_warn ("received unknown %02X with LCI 000\n" , frametype);break ; }net/x25/x25_subr.c +4
-1@@ -23,6 +23,9 @@* restriction on response. */ +#define pr_fmt (fmt) "X25: " fmt +#define DEBUG +#include <linux/slab.h> #include <linux/kernel.h> #include <linux/string.h> @@ -148,7 +151,7 @@ void x25_write_internal(struct sock *sk, int frametype)case X25_RESET_CONFIRMATION :break ;default : -printk (KERN_ERR "X.25: invalid frame type %02X\n" , frametype); +pr_err ("invalid frame type %02X\n" , frametype);return ; }
net/x25/x25_subr.c int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, · line 347
Quoted 8 lines
net/x25/x25_subr.c +1
-1@@ -338,7 +341,7 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, } } -printk (KERN_DEBUG "X.25: invalid PLP frame %02X %02X %02X\n" , +pr_debug ("invalid PLP frame %02X %02X %02X\n" , frame[0 ], frame[1 ], frame[2 ]);return X25_ILLEGAL ;
Sorry for adding the define DEBUG, It is wrong, as Daniel point out that in Documentation/dynamic-debug-howto.txt. So I will fix in v3.
Regards.
Wang
PATCH v3 1/1 x25: convert printks to pr_<level>
In reply to Wang Weidonguse pr_<level> instead of printk(LEVEL)
--- net/x25/af_x25.c | 4 +++- net/x25/x25_dev.c | 10 ++++++---- net/x25/x25_facilities.c | 14 ++++++++------ net/x25/x25_forward.c | 5 ++++- net/x25/x25_in.c | 4 +++- net/x25/x25_link.c | 6 ++++-- net/x25/x25_subr.c | 6 ++++-- 7 files changed, 32 insertions(+), 17 deletions(-)
net/x25/af_x25.c +3 -1
@@ -35,6 +35,8 @@* response */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/module.h> #include <linux/capability.h> #include <linux/errno.h>
@@ -1809,7 +1811,7 @@ static int __init x25_init(void)if (rc !=0 ) goto out_sock; -printk (KERN_INFO "X.25 for Linux Version 0.2\n" ); +pr_info ("Linux Version 0.2\n" );x25_register_sysctl (); rc =x25_proc_init ();
net/x25/x25_dev.c +6 -4
@@ -17,6 +17,8 @@* 2000-09-04 Henner Eisen Prevent freeing a dangling skb. */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/kernel.h> #include <linux/netdevice.h> #include <linux/skbuff.h>
@@ -89,7 +91,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)*/ if (frametype !=X25_CLEAR_CONFIRMATION ) -printk (KERN_DEBUG "x25_receive_data(): unknown frame type %2x\n" ,frametype); +pr_debug ("x25_receive_data(): unknown frame type %2x\n" ,frametype);return 0 ; }
@@ -114,7 +116,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,*/ nb =x25_get_neigh (dev);if (!nb) { -printk (KERN_DEBUG "X.25: unknown neighbour - %s\n" , dev->name); +pr_debug ("unknown neighbour - %s\n" , dev->name); goto drop; }
@@ -154,7 +156,7 @@ void x25_establish_link(struct x25_neigh *nb)switch (nb->dev->type) {case ARPHRD_X25 :if ((skb =alloc_skb (1 ,GFP_ATOMIC )) ==NULL ) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; } ptr =skb_put (skb,1 );
@@ -189,7 +191,7 @@ void x25_terminate_link(struct x25_neigh *nb) skb =alloc_skb (1 ,GFP_ATOMIC );if (!skb) { -printk (KERN_ERR "x25_dev: out of memory\n" ); +pr_err ("x25_dev: out of memory\n" );return ; }
net/x25/x25_facilities.c +8 -6
@@ -21,6 +21,8 @@* on response. */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/kernel.h> #include <linux/string.h> #include <linux/skbuff.h>
@@ -109,7 +111,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_MARKER :break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("unknown facility " "%02X, value %02X\n" , p[0 ], p[1 ]);break ;
@@ -132,7 +134,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_WINDOW_SIZE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility " +pr_debug ("unknown facility " "%02X, values %02X, %02X\n" , p[0 ], p[1 ], p[2 ]);break ;
@@ -143,7 +145,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities,case X25_FAC_CLASS_C :if (len <4 )return -1 ; -printk (KERN_DEBUG "X.25: unknown facility %02X, " +pr_debug ("unknown facility %02X, " "values %02X, %02X, %02X\n" , p[0 ], p[1 ], p[2 ], p[3 ]); p +=4 ;
@@ -172,7 +174,7 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, *vc_fac_mask |=X25_MASK_CALLED_AE ;break ;default : -printk (KERN_DEBUG "X.25: unknown facility %02X," +pr_debug ("unknown facility %02X," "length %d\n" , p[0 ], p[1 ]);break ; }
@@ -341,12 +343,12 @@ void x25_limit_facilities(struct x25_facilities *facilities,if (!nb->extended) {if (facilities->winsize_in >7 ) { -printk (KERN_DEBUG "X.25: incoming winsize limited to 7\n" ); +pr_debug ("incoming winsize limited to 7\n" ); facilities->winsize_in =7 ; }if (facilities->winsize_out >7 ) { facilities->winsize_out =7 ; -printk (KERN_DEBUG "X.25: outgoing winsize limited to 7\n" ); +pr_debug ("outgoing winsize limited to 7\n" ); } } }
net/x25/x25_forward.c +4 -1
@@ -8,6 +8,9 @@* History * 03-01-2007 Added forwarding for x.25 Andrew Hendry */ + +#define pr_fmt (fmt) "X25: " fmt +#include <linux/if_arp.h> #include <linux/init.h> #include <linux/slab.h>
@@ -51,7 +54,7 @@ int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,list_for_each (entry, &x25_forward_list) { x25_frwd = list_entry(entry, struct x25_forward, node);if (x25_frwd->lci == lci) { -printk (KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n" ); +pr_warn ("call request for lci which is already registered!, transmitting but not registering new pair\n" ); same_lci =1 ; } }
net/x25/x25_in.c +3 -1
@@ -23,6 +23,8 @@* i-frames. */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/slab.h> #include <linux/errno.h> #include <linux/kernel.h>
@@ -317,7 +319,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametypbreak ;default : -printk (KERN_WARNING "x25: unknown %02X in state 3\n" , frametype); +pr_warn ("unknown %02X in state 3\n" , frametype);break ; }
net/x25/x25_link.c +4 -2
@@ -21,6 +21,8 @@* 2000-09-04 Henner Eisen dev_hold() / dev_put() for x25_neigh. */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/kernel.h> #include <linux/jiffies.h> #include <linux/timer.h>
@@ -93,13 +95,13 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *nb,if (!pskb_may_pull (skb,X25_STD_MIN_LEN +4 ))break ; -printk (KERN_WARNING "x25: diagnostic #%d - %02X %02X %02X\n" , +pr_warn ("diagnostic #%d - %02X %02X %02X\n" , skb->data[3 ], skb->data[4 ], skb->data[5 ], skb->data[6 ]);break ;default : -printk (KERN_WARNING "x25: received unknown %02X with LCI 000\n" , +pr_warn ("received unknown %02X with LCI 000\n" , frametype);break ; }
net/x25/x25_subr.c +4 -2
@@ -23,6 +23,8 @@* restriction on response. */ +#define pr_fmt (fmt) "X25: " fmt +#include <linux/slab.h> #include <linux/kernel.h> #include <linux/string.h>
@@ -148,7 +150,7 @@ void x25_write_internal(struct sock *sk, int frametype)case X25_RESET_CONFIRMATION :break ;default : -printk (KERN_ERR "X.25: invalid frame type %02X\n" , frametype); +pr_err ("invalid frame type %02X\n" , frametype);return ; }
@@ -338,7 +340,7 @@ int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, } } -printk (KERN_DEBUG "X.25: invalid PLP frame %02X %02X %02X\n" , +pr_debug ("invalid PLP frame %02X %02X %02X\n" , frame[0 ], frame[1 ], frame[2 ]);return X25_ILLEGAL ;
Signature · 1 line
1.7.12
From: Wang Weidong <[email protected]>
Date: Fri, 6 Dec 2013 19:24:33 +0800
Quoted 4 lines
use pr_<level> instead of printk(LEVEL)
Suggested-by Joe Perches <[email protected]>Signed-off-by Wang Weidong <[email protected]>
Applied, thanks.