]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: Pass store hint to mgmt_new_conn_param
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 2 Jul 2014 14:37:32 +0000 (17:37 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:57 +0000 (17:42 +0200)
The calling functions of mgmt_new_conn_param have more information about
the parameters, such as whether the kernel is tracking them or not. It
makes therefore sense to have them pass an initial store_hint value to
the mgmt_new_conn_param function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_event.c
net/bluetooth/l2cap_core.c
net/bluetooth/mgmt.c

index 32c8e51f6b26f926c37054b4ec7b508d6a0f9736..d0bca13843ce5a5916481e90ce6ae4b7661bfe64 100644 (file)
@@ -1335,8 +1335,8 @@ void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
 void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
                   bool persistent);
 void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
-                        u8 bdaddr_type, u16 min_interval, u16 max_interval,
-                        u16 latency, u16 timeout);
+                        u8 bdaddr_type, u8 store_hint, u16 min_interval,
+                        u16 max_interval, u16 latency, u16 timeout);
 void mgmt_reenable_advertising(struct hci_dev *hdev);
 void mgmt_smp_complete(struct hci_conn *conn, bool complete);
 
index 3ad2576fd3f1d97c41897b76f7e75cf65d70d8dc..846f6a6af881dba19ba6da7a5a2f622ab2d8d605 100644 (file)
@@ -4431,6 +4431,7 @@ static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev,
 
        if (test_bit(HCI_CONN_MASTER, &hcon->flags)) {
                struct hci_conn_params *params;
+               u8 store_hint;
 
                hci_dev_lock(hdev);
 
@@ -4441,12 +4442,15 @@ static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev,
                        params->conn_max_interval = max;
                        params->conn_latency = latency;
                        params->supervision_timeout = timeout;
+                       store_hint = 0x01;
+               } else{
+                       store_hint = 0x00;
                }
 
                hci_dev_unlock(hdev);
 
-               mgmt_new_conn_param(hdev, &hcon->dst, hcon->dst_type, min, max,
-                                   latency, timeout);
+               mgmt_new_conn_param(hdev, &hcon->dst, hcon->dst_type,
+                                   store_hint, min, max, latency, timeout);
        }
 
        cp.handle = ev->handle;
index a6e276204ae969571c31774352e80b4fef7c1fff..dbef22d644e2cf185ec8ae0bbd143805bd22a345 100644 (file)
@@ -5250,10 +5250,14 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
                       sizeof(rsp), &rsp);
 
        if (!err) {
+               u8 store_hint;
+
+               store_hint = hci_le_conn_update(hcon, min, max, latency,
+                                               to_multiplier);
                mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type,
-                                   min, max, latency, to_multiplier);
+                                   store_hint, min, max, latency,
+                                   to_multiplier);
 
-               hci_le_conn_update(hcon, min, max, latency, to_multiplier);
        }
 
        return 0;
index 59bf1ac4142957e2810f75b0aaf74a3517a97ea0..fb1aa0cac137e42f276dee87a1d52470d614704f 100644 (file)
@@ -5790,15 +5790,15 @@ void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
 }
 
 void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
-                        u8 bdaddr_type, u16 min_interval, u16 max_interval,
-                        u16 latency, u16 timeout)
+                        u8 bdaddr_type, u8 store_hint, u16 min_interval,
+                        u16 max_interval, u16 latency, u16 timeout)
 {
        struct mgmt_ev_new_conn_param ev;
 
        memset(&ev, 0, sizeof(ev));
        bacpy(&ev.addr.bdaddr, bdaddr);
        ev.addr.type = link_to_bdaddr(LE_LINK, bdaddr_type);
-       ev.store_hint = 0x00;
+       ev.store_hint = store_hint;
        ev.min_interval = cpu_to_le16(min_interval);
        ev.max_interval = cpu_to_le16(max_interval);
        ev.latency = cpu_to_le16(latency);