Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
authorDavid S. Miller <davem@davemloft.net>
Fri, 2 Jan 2015 20:58:21 +0000 (15:58 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Jan 2015 20:58:21 +0000 (15:58 -0500)
Johan Hedberg say:

====================
pull request: bluetooth-next 2014-12-31

Here's the first batch of bluetooth patches for 3.20.

 - Cleanups & fixes to ieee802154  drivers
 - Fix synchronization of mgmt commands with respective HCI commands
 - Add self-tests for LE pairing crypto functionality
 - Remove 'BlueFritz!' specific handling from core using a new quirk flag
 - Public address configuration support for ath3012
 - Refactor debugfs support into a dedicated file
 - Initial support for LE Data Length Extension feature from Bluetooth 4.2

Please let me know if there are any issues pulling. Thanks.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
1  2 
net/bluetooth/hci_event.c

index 3f2e8b830cbd1cf37b65431bfd76981bc2447dff,eed44c643c0c213c9400e48868f60908c95f7055..0881efd0ad2d8802ea32fd7cd6c882030fc7cafc
@@@ -30,6 -30,8 +30,8 @@@
  #include <net/bluetooth/hci_core.h>
  #include <net/bluetooth/mgmt.h>
  
+ #include "hci_request.h"
+ #include "hci_debugfs.h"
  #include "a2mp.h"
  #include "amp.h"
  #include "smp.h"
@@@ -242,8 -244,7 +244,8 @@@ static void hci_cc_read_local_name(stru
        if (rp->status)
                return;
  
 -      if (test_bit(HCI_SETUP, &hdev->dev_flags))
 +      if (test_bit(HCI_SETUP, &hdev->dev_flags) ||
 +          test_bit(HCI_CONFIG, &hdev->dev_flags))
                memcpy(hdev->dev_name, rp->name, HCI_MAX_NAME_LENGTH);
  }
  
@@@ -510,8 -511,7 +512,8 @@@ static void hci_cc_read_local_version(s
        if (rp->status)
                return;
  
 -      if (test_bit(HCI_SETUP, &hdev->dev_flags)) {
 +      if (test_bit(HCI_SETUP, &hdev->dev_flags) ||
 +          test_bit(HCI_CONFIG, &hdev->dev_flags)) {
                hdev->hci_ver = rp->hci_ver;
                hdev->hci_rev = __le16_to_cpu(rp->hci_rev);
                hdev->lmp_ver = rp->lmp_ver;
@@@ -530,8 -530,7 +532,8 @@@ static void hci_cc_read_local_commands(
        if (rp->status)
                return;
  
 -      if (test_bit(HCI_SETUP, &hdev->dev_flags))
 +      if (test_bit(HCI_SETUP, &hdev->dev_flags) ||
 +          test_bit(HCI_CONFIG, &hdev->dev_flags))
                memcpy(hdev->commands, rp->commands, sizeof(hdev->commands));
  }
  
@@@ -1282,6 -1281,55 +1284,55 @@@ static void hci_cc_le_read_supported_st
        memcpy(hdev->le_states, rp->le_states, 8);
  }
  
+ static void hci_cc_le_read_def_data_len(struct hci_dev *hdev,
+                                       struct sk_buff *skb)
+ {
+       struct hci_rp_le_read_def_data_len *rp = (void *) skb->data;
+       BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
+       if (rp->status)
+               return;
+       hdev->le_def_tx_len = le16_to_cpu(rp->tx_len);
+       hdev->le_def_tx_time = le16_to_cpu(rp->tx_time);
+ }
+ static void hci_cc_le_write_def_data_len(struct hci_dev *hdev,
+                                        struct sk_buff *skb)
+ {
+       struct hci_cp_le_write_def_data_len *sent;
+       __u8 status = *((__u8 *) skb->data);
+       BT_DBG("%s status 0x%2.2x", hdev->name, status);
+       if (status)
+               return;
+       sent = hci_sent_cmd_data(hdev, HCI_OP_LE_WRITE_DEF_DATA_LEN);
+       if (!sent)
+               return;
+       hdev->le_def_tx_len = le16_to_cpu(sent->tx_len);
+       hdev->le_def_tx_time = le16_to_cpu(sent->tx_time);
+ }
+ static void hci_cc_le_read_max_data_len(struct hci_dev *hdev,
+                                       struct sk_buff *skb)
+ {
+       struct hci_rp_le_read_max_data_len *rp = (void *) skb->data;
+       BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
+       if (rp->status)
+               return;
+       hdev->le_max_tx_len = le16_to_cpu(rp->tx_len);
+       hdev->le_max_tx_time = le16_to_cpu(rp->tx_time);
+       hdev->le_max_rx_len = le16_to_cpu(rp->rx_len);
+       hdev->le_max_rx_time = le16_to_cpu(rp->rx_time);
+ }
  static void hci_cc_write_le_host_supported(struct hci_dev *hdev,
                                           struct sk_buff *skb)
  {
@@@ -2115,6 -2163,7 +2166,7 @@@ static void hci_conn_complete_evt(struc
                } else
                        conn->state = BT_CONNECTED;
  
+               hci_debugfs_create_conn(conn);
                hci_conn_add_sysfs(conn);
  
                if (test_bit(HCI_AUTH, &hdev->flags))
                        hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES,
                                     sizeof(cp), &cp);
  
-                       hci_update_page_scan(hdev, NULL);
+                       hci_update_page_scan(hdev);
                }
  
                /* Set packet type for incoming connection */
@@@ -2197,12 -2246,7 +2249,12 @@@ static void hci_conn_request_evt(struc
                return;
        }
  
 -      if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags) &&
 +      /* Require HCI_CONNECTABLE or a whitelist entry to accept the
 +       * connection. These features are only touched through mgmt so
 +       * only do the checks if HCI_MGMT is set.
 +       */
 +      if (test_bit(HCI_MGMT, &hdev->dev_flags) &&
 +          !test_bit(HCI_CONNECTABLE, &hdev->dev_flags) &&
            !hci_bdaddr_list_lookup(&hdev->whitelist, &ev->bdaddr,
                                    BDADDR_BREDR)) {
                    hci_reject_conn(hdev, &ev->bdaddr);
@@@ -2316,7 -2360,7 +2368,7 @@@ static void hci_disconn_complete_evt(st
                if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
                        hci_remove_link_key(hdev, &conn->dst);
  
-               hci_update_page_scan(hdev, NULL);
+               hci_update_page_scan(hdev);
        }
  
        params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
@@@ -2854,6 -2898,18 +2906,18 @@@ static void hci_cmd_complete_evt(struc
                hci_cc_le_read_supported_states(hdev, skb);
                break;
  
+       case HCI_OP_LE_READ_DEF_DATA_LEN:
+               hci_cc_le_read_def_data_len(hdev, skb);
+               break;
+       case HCI_OP_LE_WRITE_DEF_DATA_LEN:
+               hci_cc_le_write_def_data_len(hdev, skb);
+               break;
+       case HCI_OP_LE_READ_MAX_DATA_LEN:
+               hci_cc_le_read_max_data_len(hdev, skb);
+               break;
        case HCI_OP_WRITE_LE_HOST_SUPPORTED:
                hci_cc_write_le_host_supported(hdev, skb);
                break;
@@@ -3584,6 -3640,7 +3648,7 @@@ static void hci_sync_conn_complete_evt(
                conn->handle = __le16_to_cpu(ev->handle);
                conn->state  = BT_CONNECTED;
  
+               hci_debugfs_create_conn(conn);
                hci_conn_add_sysfs(conn);
                break;
  
@@@ -4124,6 -4181,7 +4189,7 @@@ static void hci_phy_link_complete_evt(s
        hcon->disc_timeout = HCI_DISCONN_TIMEOUT;
        hci_conn_drop(hcon);
  
+       hci_debugfs_create_conn(hcon);
        hci_conn_add_sysfs(hcon);
  
        amp_physical_cfm(bredr_hcon, hcon);
@@@ -4330,6 -4388,7 +4396,7 @@@ static void hci_le_conn_complete_evt(st
        conn->le_conn_latency = le16_to_cpu(ev->latency);
        conn->le_supv_timeout = le16_to_cpu(ev->supervision_timeout);
  
+       hci_debugfs_create_conn(conn);
        hci_conn_add_sysfs(conn);
  
        hci_proto_connect_cfm(conn, ev->status);