Commit 9b6d5398 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

rxrpc: Use pr_<level> and pr_fmt, reduce object size a few KB

Use the more common kernel logging style and reduce object size.

The logging message prefix changes from a mixture of
"RxRPC:" and "RXRPC:" to "af_rxrpc: ".

$ size net/rxrpc/built-in.o*
   text	   data	    bss	    dec	    hex	filename
  64172	   1972	   8304	  74448	  122d0	net/rxrpc/built-in.o.new
  67512	   1972	   8304	  77788	  12fdc	net/rxrpc/built-in.o.old

Miscellanea:

o Consolidate the ASSERT macros to use a single pr_err call with
  decimal and hexadecimal output and a stringified #OP argument
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cb2911fe
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/net.h> #include <linux/net.h>
...@@ -796,49 +798,49 @@ static int __init af_rxrpc_init(void) ...@@ -796,49 +798,49 @@ static int __init af_rxrpc_init(void)
"rxrpc_call_jar", sizeof(struct rxrpc_call), 0, "rxrpc_call_jar", sizeof(struct rxrpc_call), 0,
SLAB_HWCACHE_ALIGN, NULL); SLAB_HWCACHE_ALIGN, NULL);
if (!rxrpc_call_jar) { if (!rxrpc_call_jar) {
printk(KERN_NOTICE "RxRPC: Failed to allocate call jar\n"); pr_notice("Failed to allocate call jar\n");
goto error_call_jar; goto error_call_jar;
} }
rxrpc_workqueue = alloc_workqueue("krxrpcd", 0, 1); rxrpc_workqueue = alloc_workqueue("krxrpcd", 0, 1);
if (!rxrpc_workqueue) { if (!rxrpc_workqueue) {
printk(KERN_NOTICE "RxRPC: Failed to allocate work queue\n"); pr_notice("Failed to allocate work queue\n");
goto error_work_queue; goto error_work_queue;
} }
ret = rxrpc_init_security(); ret = rxrpc_init_security();
if (ret < 0) { if (ret < 0) {
printk(KERN_CRIT "RxRPC: Cannot initialise security\n"); pr_crit("Cannot initialise security\n");
goto error_security; goto error_security;
} }
ret = proto_register(&rxrpc_proto, 1); ret = proto_register(&rxrpc_proto, 1);
if (ret < 0) { if (ret < 0) {
printk(KERN_CRIT "RxRPC: Cannot register protocol\n"); pr_crit("Cannot register protocol\n");
goto error_proto; goto error_proto;
} }
ret = sock_register(&rxrpc_family_ops); ret = sock_register(&rxrpc_family_ops);
if (ret < 0) { if (ret < 0) {
printk(KERN_CRIT "RxRPC: Cannot register socket family\n"); pr_crit("Cannot register socket family\n");
goto error_sock; goto error_sock;
} }
ret = register_key_type(&key_type_rxrpc); ret = register_key_type(&key_type_rxrpc);
if (ret < 0) { if (ret < 0) {
printk(KERN_CRIT "RxRPC: Cannot register client key type\n"); pr_crit("Cannot register client key type\n");
goto error_key_type; goto error_key_type;
} }
ret = register_key_type(&key_type_rxrpc_s); ret = register_key_type(&key_type_rxrpc_s);
if (ret < 0) { if (ret < 0) {
printk(KERN_CRIT "RxRPC: Cannot register server key type\n"); pr_crit("Cannot register server key type\n");
goto error_key_type_s; goto error_key_type_s;
} }
ret = rxrpc_sysctl_init(); ret = rxrpc_sysctl_init();
if (ret < 0) { if (ret < 0) {
printk(KERN_CRIT "RxRPC: Cannot register sysctls\n"); pr_crit("Cannot register sysctls\n");
goto error_sysctls; goto error_sysctls;
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/circ_buf.h> #include <linux/circ_buf.h>
#include <linux/net.h> #include <linux/net.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/circ_buf.h> #include <linux/circ_buf.h>
...@@ -669,8 +671,7 @@ void rxrpc_release_call(struct rxrpc_call *call) ...@@ -669,8 +671,7 @@ void rxrpc_release_call(struct rxrpc_call *call)
conn->channels[3] == NULL); conn->channels[3] == NULL);
break; break;
default: default:
printk(KERN_ERR "RxRPC: conn->avail_calls=%d\n", pr_err("conn->avail_calls=%d\n", conn->avail_calls);
conn->avail_calls);
BUG(); BUG();
} }
} }
...@@ -935,16 +936,15 @@ void __exit rxrpc_destroy_all_calls(void) ...@@ -935,16 +936,15 @@ void __exit rxrpc_destroy_all_calls(void)
if (call->state != RXRPC_CALL_DEAD) if (call->state != RXRPC_CALL_DEAD)
break; break;
default: default:
printk(KERN_ERR "RXRPC:" pr_err("Call %p still in use (%d,%d,%s,%lx,%lx)!\n",
" Call %p still in use (%d,%d,%s,%lx,%lx)!\n",
call, atomic_read(&call->usage), call, atomic_read(&call->usage),
atomic_read(&call->ackr_not_idle), atomic_read(&call->ackr_not_idle),
rxrpc_call_states[call->state], rxrpc_call_states[call->state],
call->flags, call->events); call->flags, call->events);
if (!skb_queue_empty(&call->rx_queue)) if (!skb_queue_empty(&call->rx_queue))
printk(KERN_ERR"RXRPC: Rx queue occupied\n"); pr_err("Rx queue occupied\n");
if (!skb_queue_empty(&call->rx_oos_queue)) if (!skb_queue_empty(&call->rx_oos_queue))
printk(KERN_ERR"RXRPC: OOS queue occupied\n"); pr_err("OOS queue occupied\n");
break; break;
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/net.h> #include <linux/net.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -744,21 +744,18 @@ do { \ ...@@ -744,21 +744,18 @@ do { \
#define ASSERT(X) \ #define ASSERT(X) \
do { \ do { \
if (unlikely(!(X))) { \ if (unlikely(!(X))) { \
printk(KERN_ERR "\n"); \ pr_err("Assertion failed\n"); \
printk(KERN_ERR "RxRPC: Assertion failed\n"); \
BUG(); \ BUG(); \
} \ } \
} while (0) } while (0)
#define ASSERTCMP(X, OP, Y) \ #define ASSERTCMP(X, OP, Y) \
do { \ do { \
if (unlikely(!((X) OP (Y)))) { \ unsigned long _x = (unsigned long)(X); \
printk(KERN_ERR "\n"); \ unsigned long _y = (unsigned long)(Y); \
printk(KERN_ERR "RxRPC: Assertion failed\n"); \ if (unlikely(!(_x OP _y))) { \
printk(KERN_ERR "%lu " #OP " %lu is false\n", \ pr_err("Assertion failed - %lu(0x%lx) %s %lu(0x%lx) is false\n", \
(unsigned long)(X), (unsigned long)(Y)); \ _x, _x, #OP, _y, _y); \
printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \
(unsigned long)(X), (unsigned long)(Y)); \
BUG(); \ BUG(); \
} \ } \
} while (0) } while (0)
...@@ -766,21 +763,18 @@ do { \ ...@@ -766,21 +763,18 @@ do { \
#define ASSERTIF(C, X) \ #define ASSERTIF(C, X) \
do { \ do { \
if (unlikely((C) && !(X))) { \ if (unlikely((C) && !(X))) { \
printk(KERN_ERR "\n"); \ pr_err("Assertion failed\n"); \
printk(KERN_ERR "RxRPC: Assertion failed\n"); \
BUG(); \ BUG(); \
} \ } \
} while (0) } while (0)
#define ASSERTIFCMP(C, X, OP, Y) \ #define ASSERTIFCMP(C, X, OP, Y) \
do { \ do { \
if (unlikely((C) && !((X) OP (Y)))) { \ unsigned long _x = (unsigned long)(X); \
printk(KERN_ERR "\n"); \ unsigned long _y = (unsigned long)(Y); \
printk(KERN_ERR "RxRPC: Assertion failed\n"); \ if (unlikely((C) && !(_x OP _y))) { \
printk(KERN_ERR "%lu " #OP " %lu is false\n", \ pr_err("Assertion failed - %lu(0x%lx) %s %lu(0x%lx) is false\n", \
(unsigned long)(X), (unsigned long)(Y)); \ _x, _x, #OP, _y, _y); \
printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \
(unsigned long)(X), (unsigned long)(Y)); \
BUG(); \ BUG(); \
} \ } \
} while (0) } while (0)
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
* "afs@CAMBRIDGE.REDHAT.COM> * "afs@CAMBRIDGE.REDHAT.COM>
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <crypto/skcipher.h> #include <crypto/skcipher.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/net.h> #include <linux/net.h>
...@@ -800,7 +802,7 @@ static void rxrpc_free_token_list(struct rxrpc_key_token *token) ...@@ -800,7 +802,7 @@ static void rxrpc_free_token_list(struct rxrpc_key_token *token)
rxrpc_rxk5_free(token->k5); rxrpc_rxk5_free(token->k5);
break; break;
default: default:
printk(KERN_ERR "Unknown token type %x on rxrpc key\n", pr_err("Unknown token type %x on rxrpc key\n",
token->security_index); token->security_index);
BUG(); BUG();
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/net.h> #include <linux/net.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/net.h> #include <linux/net.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/export.h> #include <linux/export.h>
...@@ -307,7 +309,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, ...@@ -307,7 +309,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
&abort_code); &abort_code);
break; break;
default: default:
pr_err("RxRPC: Unknown packet mark %u\n", skb->mark); pr_err("Unknown packet mark %u\n", skb->mark);
BUG(); BUG();
break; break;
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <crypto/skcipher.h> #include <crypto/skcipher.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/net.h> #include <linux/net.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment