Merge tag 'dt-for-3.6' of git://sources.calxeda.com/kernel/linux
[firefly-linux-kernel-4.4.55.git] / net / bluetooth / hci_conn.c
index 2fcced377e503ad2e9feded38ec5609748e7d2ff..5ad7da21747413f50ba0106041c6e73d6ce727d4 100644 (file)
@@ -107,7 +107,7 @@ static void hci_acl_connect_cancel(struct hci_conn *conn)
 {
        struct hci_cp_create_conn_cancel cp;
 
-       BT_DBG("%p", conn);
+       BT_DBG("hcon %p", conn);
 
        if (conn->hdev->hci_ver < BLUETOOTH_VER_1_2)
                return;
@@ -120,7 +120,7 @@ void hci_acl_disconn(struct hci_conn *conn, __u8 reason)
 {
        struct hci_cp_disconnect cp;
 
-       BT_DBG("%p", conn);
+       BT_DBG("hcon %p", conn);
 
        conn->state = BT_DISCONN;
 
@@ -134,7 +134,7 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle)
        struct hci_dev *hdev = conn->hdev;
        struct hci_cp_add_sco cp;
 
-       BT_DBG("%p", conn);
+       BT_DBG("hcon %p", conn);
 
        conn->state = BT_CONNECT;
        conn->out = true;
@@ -152,7 +152,7 @@ void hci_setup_sync(struct hci_conn *conn, __u16 handle)
        struct hci_dev *hdev = conn->hdev;
        struct hci_cp_setup_sync_conn cp;
 
-       BT_DBG("%p", conn);
+       BT_DBG("hcon %p", conn);
 
        conn->state = BT_CONNECT;
        conn->out = true;
@@ -196,7 +196,7 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
        struct hci_dev *hdev = conn->hdev;
        struct hci_cp_le_start_enc cp;
 
-       BT_DBG("%p", conn);
+       BT_DBG("hcon %p", conn);
 
        memset(&cp, 0, sizeof(cp));
 
@@ -213,11 +213,11 @@ void hci_sco_setup(struct hci_conn *conn, __u8 status)
 {
        struct hci_conn *sco = conn->link;
 
-       BT_DBG("%p", conn);
-
        if (!sco)
                return;
 
+       BT_DBG("hcon %p", conn);
+
        if (!status) {
                if (lmp_esco_capable(conn->hdev))
                        hci_setup_sync(sco, conn->handle);
@@ -235,7 +235,7 @@ static void hci_conn_timeout(struct work_struct *work)
                                             disc_work.work);
        __u8 reason;
 
-       BT_DBG("conn %p state %s", conn, state_to_string(conn->state));
+       BT_DBG("hcon %p state %s", conn, state_to_string(conn->state));
 
        if (atomic_read(&conn->refcnt))
                return;
@@ -266,7 +266,7 @@ static void hci_conn_enter_sniff_mode(struct hci_conn *conn)
 {
        struct hci_dev *hdev = conn->hdev;
 
-       BT_DBG("conn %p mode %d", conn, conn->mode);
+       BT_DBG("hcon %p mode %d", conn, conn->mode);
 
        if (test_bit(HCI_RAW, &hdev->flags))
                return;
@@ -301,7 +301,7 @@ static void hci_conn_idle(unsigned long arg)
 {
        struct hci_conn *conn = (void *) arg;
 
-       BT_DBG("conn %p mode %d", conn, conn->mode);
+       BT_DBG("hcon %p mode %d", conn, conn->mode);
 
        hci_conn_enter_sniff_mode(conn);
 }
@@ -382,7 +382,7 @@ int hci_conn_del(struct hci_conn *conn)
 {
        struct hci_dev *hdev = conn->hdev;
 
-       BT_DBG("%s conn %p handle %d", hdev->name, conn, conn->handle);
+       BT_DBG("%s hcon %p handle %d", hdev->name, conn, conn->handle);
 
        del_timer(&conn->idle_timer);
 
@@ -442,7 +442,8 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
 
        list_for_each_entry(d, &hci_dev_list, list) {
                if (!test_bit(HCI_UP, &d->flags) ||
-                   test_bit(HCI_RAW, &d->flags))
+                   test_bit(HCI_RAW, &d->flags) ||
+                   d->dev_type != HCI_BREDR)
                        continue;
 
                /* Simple routing:
@@ -557,7 +558,7 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
 /* Check link security requirement */
 int hci_conn_check_link_mode(struct hci_conn *conn)
 {
-       BT_DBG("conn %p", conn);
+       BT_DBG("hcon %p", conn);
 
        if (hci_conn_ssp_enabled(conn) && !(conn->link_mode & HCI_LM_ENCRYPT))
                return 0;
@@ -568,7 +569,7 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
 /* Authenticate remote device */
 static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
 {
-       BT_DBG("conn %p", conn);
+       BT_DBG("hcon %p", conn);
 
        if (conn->pending_sec_level > sec_level)
                sec_level = conn->pending_sec_level;
@@ -602,7 +603,7 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
 /* Encrypt the the link */
 static void hci_conn_encrypt(struct hci_conn *conn)
 {
-       BT_DBG("conn %p", conn);
+       BT_DBG("hcon %p", conn);
 
        if (!test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) {
                struct hci_cp_set_conn_encrypt cp;
@@ -616,7 +617,7 @@ static void hci_conn_encrypt(struct hci_conn *conn)
 /* Enable security */
 int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
 {
-       BT_DBG("conn %p", conn);
+       BT_DBG("hcon %p", conn);
 
        /* For sdp we don't need the link key. */
        if (sec_level == BT_SECURITY_SDP)
@@ -669,7 +670,7 @@ EXPORT_SYMBOL(hci_conn_security);
 /* Check secure link requirement */
 int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level)
 {
-       BT_DBG("conn %p", conn);
+       BT_DBG("hcon %p", conn);
 
        if (sec_level != BT_SECURITY_HIGH)
                return 1; /* Accept if non-secure is required */
@@ -684,7 +685,7 @@ EXPORT_SYMBOL(hci_conn_check_secure);
 /* Change link key */
 int hci_conn_change_link_key(struct hci_conn *conn)
 {
-       BT_DBG("conn %p", conn);
+       BT_DBG("hcon %p", conn);
 
        if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
                struct hci_cp_change_conn_link_key cp;
@@ -699,7 +700,7 @@ int hci_conn_change_link_key(struct hci_conn *conn)
 /* Switch role */
 int hci_conn_switch_role(struct hci_conn *conn, __u8 role)
 {
-       BT_DBG("conn %p", conn);
+       BT_DBG("hcon %p", conn);
 
        if (!role && conn->link_mode & HCI_LM_MASTER)
                return 1;
@@ -720,7 +721,7 @@ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active)
 {
        struct hci_dev *hdev = conn->hdev;
 
-       BT_DBG("conn %p mode %d", conn, conn->mode);
+       BT_DBG("hcon %p mode %d", conn, conn->mode);
 
        if (test_bit(HCI_RAW, &hdev->flags))
                return;
@@ -894,7 +895,7 @@ struct hci_chan *hci_chan_create(struct hci_conn *conn)
        struct hci_dev *hdev = conn->hdev;
        struct hci_chan *chan;
 
-       BT_DBG("%s conn %p", hdev->name, conn);
+       BT_DBG("%s hcon %p", hdev->name, conn);
 
        chan = kzalloc(sizeof(struct hci_chan), GFP_KERNEL);
        if (!chan)
@@ -913,7 +914,7 @@ int hci_chan_del(struct hci_chan *chan)
        struct hci_conn *conn = chan->conn;
        struct hci_dev *hdev = conn->hdev;
 
-       BT_DBG("%s conn %p chan %p", hdev->name, conn, chan);
+       BT_DBG("%s hcon %p chan %p", hdev->name, conn, chan);
 
        list_del_rcu(&chan->list);
 
@@ -929,7 +930,7 @@ void hci_chan_list_flush(struct hci_conn *conn)
 {
        struct hci_chan *chan, *n;
 
-       BT_DBG("conn %p", conn);
+       BT_DBG("hcon %p", conn);
 
        list_for_each_entry_safe(chan, n, &conn->chan_list, list)
                hci_chan_del(chan);