Bluetooth: Move scope of state_to_string
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Fri, 17 Feb 2012 09:40:55 +0000 (11:40 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 17 Feb 2012 11:01:10 +0000 (13:01 +0200)
Function state_to_string will be used in other files in debug
statements.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/bluetooth.h
net/bluetooth/l2cap_core.c

index 9f5f2c1c55544ce3b2e8c080662df9f4aab017f7..5ca9219fe940bca026ffd32a887acff9ff4adb80 100644 (file)
@@ -131,6 +131,33 @@ enum {
        BT_CLOSED
 };
 
+/* If unused will be removed by compiler */
+static inline const char *state_to_string(int state)
+{
+       switch (state) {
+       case BT_CONNECTED:
+               return "BT_CONNECTED";
+       case BT_OPEN:
+               return "BT_OPEN";
+       case BT_BOUND:
+               return "BT_BOUND";
+       case BT_LISTEN:
+               return "BT_LISTEN";
+       case BT_CONNECT:
+               return "BT_CONNECT";
+       case BT_CONNECT2:
+               return "BT_CONNECT2";
+       case BT_CONFIG:
+               return "BT_CONFIG";
+       case BT_DISCONN:
+               return "BT_DISCONN";
+       case BT_CLOSED:
+               return "BT_CLOSED";
+       }
+
+       return "invalid state";
+}
+
 /* BD Address */
 typedef struct {
        __u8 b[6];
index 8efac7884ffb275b22d9cbf2a7a8b6154ec07baa..252a96e474ca1971c7d2ca937dc0ec0ba420962a 100644 (file)
@@ -215,32 +215,6 @@ static u16 l2cap_alloc_cid(struct l2cap_conn *conn)
        return 0;
 }
 
-static char *state_to_string(int state)
-{
-       switch(state) {
-       case BT_CONNECTED:
-               return "BT_CONNECTED";
-       case BT_OPEN:
-               return "BT_OPEN";
-       case BT_BOUND:
-               return "BT_BOUND";
-       case BT_LISTEN:
-               return "BT_LISTEN";
-       case BT_CONNECT:
-               return "BT_CONNECT";
-       case BT_CONNECT2:
-               return "BT_CONNECT2";
-       case BT_CONFIG:
-               return "BT_CONFIG";
-       case BT_DISCONN:
-               return "BT_DISCONN";
-       case BT_CLOSED:
-               return "BT_CLOSED";
-       }
-
-       return "invalid state";
-}
-
 static void l2cap_state_change(struct l2cap_chan *chan, int state)
 {
        BT_DBG("%p %s -> %s", chan, state_to_string(chan->state),