]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
rxrpc: Use pr_<level> and pr_fmt, reduce object size a few KB
authorJoe Perches <joe@perches.com>
Thu, 2 Jun 2016 19:08:52 +0000 (12:08 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Jun 2016 23:41:31 +0000 (19:41 -0400)
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: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 files changed:
net/rxrpc/af_rxrpc.c
net/rxrpc/ar-accept.c
net/rxrpc/ar-ack.c
net/rxrpc/ar-call.c
net/rxrpc/ar-connection.c
net/rxrpc/ar-connevent.c
net/rxrpc/ar-input.c
net/rxrpc/ar-internal.h
net/rxrpc/ar-key.c
net/rxrpc/ar-local.c
net/rxrpc/ar-output.c
net/rxrpc/ar-peer.c
net/rxrpc/ar-recvmsg.c
net/rxrpc/ar-skbuff.c
net/rxrpc/ar-transport.c
net/rxrpc/rxkad.c

index e45e94ca030f3b1e3a6881d3178b021b4ce670ad..7840b8e7da80ba1caa61083f158c80bf0e234e86 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/net.h>
@@ -796,49 +798,49 @@ static int __init af_rxrpc_init(void)
                "rxrpc_call_jar", sizeof(struct rxrpc_call), 0,
                SLAB_HWCACHE_ALIGN, NULL);
        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;
        }
 
        rxrpc_workqueue = alloc_workqueue("krxrpcd", 0, 1);
        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;
        }
 
        ret = rxrpc_init_security();
        if (ret < 0) {
-               printk(KERN_CRIT "RxRPC: Cannot initialise security\n");
+               pr_crit("Cannot initialise security\n");
                goto error_security;
        }
 
        ret = proto_register(&rxrpc_proto, 1);
        if (ret < 0) {
-               printk(KERN_CRIT "RxRPC: Cannot register protocol\n");
+               pr_crit("Cannot register protocol\n");
                goto error_proto;
        }
 
        ret = sock_register(&rxrpc_family_ops);
        if (ret < 0) {
-               printk(KERN_CRIT "RxRPC: Cannot register socket family\n");
+               pr_crit("Cannot register socket family\n");
                goto error_sock;
        }
 
        ret = register_key_type(&key_type_rxrpc);
        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;
        }
 
        ret = register_key_type(&key_type_rxrpc_s);
        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;
        }
 
        ret = rxrpc_sysctl_init();
        if (ret < 0) {
-               printk(KERN_CRIT "RxRPC: Cannot register sysctls\n");
+               pr_crit("Cannot register sysctls\n");
                goto error_sysctls;
        }
 
index e7a7f05f13e2b0b39d921cf312e9a6aeb6599571..eea5f4a5d8b1fbb68f206eb113e32ad280ae5b54 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/skbuff.h>
index 374478e006e7c806a82b9dd907907f39e1d4cd5c..18381783c2b12633ab112bda43b9aeee636006f0 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/circ_buf.h>
 #include <linux/net.h>
index 571a41fd5a324705a30e78304833b39c8c501380..1fbaae1cba5f7ce2d37c7c728774883da9acf83a 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/circ_buf.h>
@@ -669,8 +671,7 @@ void rxrpc_release_call(struct rxrpc_call *call)
                               conn->channels[3] == NULL);
                        break;
                default:
-                       printk(KERN_ERR "RxRPC: conn->avail_calls=%d\n",
-                              conn->avail_calls);
+                       pr_err("conn->avail_calls=%d\n", conn->avail_calls);
                        BUG();
                }
        }
@@ -935,16 +936,15 @@ void __exit rxrpc_destroy_all_calls(void)
                        if (call->state != RXRPC_CALL_DEAD)
                                break;
                default:
-                       printk(KERN_ERR "RXRPC:"
-                              " Call %p still in use (%d,%d,%s,%lx,%lx)!\n",
+                       pr_err("Call %p still in use (%d,%d,%s,%lx,%lx)!\n",
                               call, atomic_read(&call->usage),
                               atomic_read(&call->ackr_not_idle),
                               rxrpc_call_states[call->state],
                               call->flags, call->events);
                        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))
-                               printk(KERN_ERR"RXRPC: OOS queue occupied\n");
+                               pr_err("OOS queue occupied\n");
                        break;
                }
 
index 97f4fae74bcab5c2305801d85dca51a3295e3663..d67b1f1b5001c498adae114d9c4558ca696f1f69 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/net.h>
index 5f9563968a5b498e837bef9baf2921867a8073da..8bdd692d486294003631caf0d5d143875e031c78 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/skbuff.h>
index 6ff97412a0bb15450b42f412be02ab8d3d2edbd2..d7c2a0bc839e03ec9f5212127e450d78837f982d 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/skbuff.h>
index f0b807a163fa3d7d10cc4ddb7fd66c0129a7ca44..18ab5c50ba87565d468ee0e6d037ec8033d72e52 100644 (file)
@@ -744,21 +744,18 @@ do {                                                      \
 #define ASSERT(X)                                              \
 do {                                                           \
        if (unlikely(!(X))) {                                   \
-               printk(KERN_ERR "\n");                          \
-               printk(KERN_ERR "RxRPC: Assertion failed\n");   \
+               pr_err("Assertion failed\n");                   \
                BUG();                                          \
        }                                                       \
 } while (0)
 
 #define ASSERTCMP(X, OP, Y)                                            \
 do {                                                                   \
-       if (unlikely(!((X) OP (Y)))) {                                  \
-               printk(KERN_ERR "\n");                                  \
-               printk(KERN_ERR "RxRPC: Assertion failed\n");           \
-               printk(KERN_ERR "%lu " #OP " %lu is false\n",           \
-                      (unsigned long)(X), (unsigned long)(Y));         \
-               printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n",       \
-                      (unsigned long)(X), (unsigned long)(Y));         \
+       unsigned long _x = (unsigned long)(X);                          \
+       unsigned long _y = (unsigned long)(Y);                          \
+       if (unlikely(!(_x OP _y))) {                                    \
+               pr_err("Assertion failed - %lu(0x%lx) %s %lu(0x%lx) is false\n",                        \
+                      _x, _x, #OP, _y, _y);                            \
                BUG();                                                  \
        }                                                               \
 } while (0)
@@ -766,21 +763,18 @@ do {                                                                      \
 #define ASSERTIF(C, X)                                         \
 do {                                                           \
        if (unlikely((C) && !(X))) {                            \
-               printk(KERN_ERR "\n");                          \
-               printk(KERN_ERR "RxRPC: Assertion failed\n");   \
+               pr_err("Assertion failed\n");                   \
                BUG();                                          \
        }                                                       \
 } while (0)
 
 #define ASSERTIFCMP(C, X, OP, Y)                                       \
 do {                                                                   \
-       if (unlikely((C) && !((X) OP (Y)))) {                           \
-               printk(KERN_ERR "\n");                                  \
-               printk(KERN_ERR "RxRPC: Assertion failed\n");           \
-               printk(KERN_ERR "%lu " #OP " %lu is false\n",           \
-                      (unsigned long)(X), (unsigned long)(Y));         \
-               printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n",       \
-                      (unsigned long)(X), (unsigned long)(Y));         \
+       unsigned long _x = (unsigned long)(X);                          \
+       unsigned long _y = (unsigned long)(Y);                          \
+       if (unlikely((C) && !(_x OP _y))) {                             \
+               pr_err("Assertion failed - %lu(0x%lx) %s %lu(0x%lx) is false\n", \
+                      _x, _x, #OP, _y, _y);                            \
                BUG();                                                  \
        }                                                               \
 } while (0)
index 1021b4c0bdd21e776481e771a4f3a1385e67f5a6..4ad56fafe3a7911f443de771d728889f8b2d1c2f 100644 (file)
@@ -12,6 +12,8 @@
  *     "afs@CAMBRIDGE.REDHAT.COM>
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <crypto/skcipher.h>
 #include <linux/module.h>
 #include <linux/net.h>
@@ -800,7 +802,7 @@ static void rxrpc_free_token_list(struct rxrpc_key_token *token)
                                rxrpc_rxk5_free(token->k5);
                        break;
                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);
                        BUG();
                }
index 4e1e6db0050b900a4afd9dfb2ff9a0b1974d1634..701c42b7050efa9c407343f1faaf67478364d77f 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/skbuff.h>
index 51cb10062a8dd2ad877e57a5ba49cc8ea1da0159..ea619535f0edad5b267922f7896134781532c4ab 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/net.h>
 #include <linux/gfp.h>
 #include <linux/skbuff.h>
index dc089b1976aa3d4b5a7a040a9ebe7ad2c0586e84..0b54cda3d8e5572def01819515c7209dbcced2dc 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/skbuff.h>
index 160f0927aa3e8921ec030a0b2733cab71c2961be..59706b9f2f7a4e859932e7007c7719de8e157556 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/net.h>
 #include <linux/skbuff.h>
 #include <linux/export.h>
@@ -307,7 +309,7 @@ receive_non_data_message:
                               &abort_code);
                break;
        default:
-               pr_err("RxRPC: Unknown packet mark %u\n", skb->mark);
+               pr_err("Unknown packet mark %u\n", skb->mark);
                BUG();
                break;
        }
index 62a267472fceaee48db0149e64a911e4b17b4b53..eee0cfd9ac8c0d8c2a7cb4e52a213df0df2f6082 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/skbuff.h>
index 66a1a56764462d40d3f89d8874fd861e35f4bf75..a1b65183b07df36bb5eaa0a67879d6182f44f166 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/skbuff.h>
index 6b726a046a7d47995ecc281f67979073fe02c102..d4da538b3d3c608055a9577cc2e2480b12ef7c5e 100644 (file)
@@ -9,6 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <crypto/skcipher.h>
 #include <linux/module.h>
 #include <linux/net.h>