Bluetooth: Convert hcon->flush_key to a proper flag
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 24 Jun 2014 10:15:53 +0000 (13:15 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:46 +0000 (17:42 +0200)
There's no point in having boolean variables in the hci_conn struct
since it already has a flags member. This patch converts the flush_key
member into a proper flag.

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

index 888911d205dc9e865d88e5ea6e0feb445cc571ce..4f70605e039968069ddc4ce3c991258b63628a9b 100644 (file)
@@ -394,7 +394,6 @@ struct hci_conn {
        __u8            remote_cap;
        __u8            remote_auth;
        __u8            remote_id;
-       bool            flush_key;
 
        unsigned int    sent;
 
@@ -524,6 +523,7 @@ enum {
        HCI_CONN_AES_CCM,
        HCI_CONN_POWER_SAVE,
        HCI_CONN_REMOTE_OOB,
+       HCI_CONN_FLUSH_KEY,
 };
 
 static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
index c92c5a020fe737b9884821dcc167eaaf25b059d0..90cba6a8293bd8c32dd003bb0ab48664431ef40a 100644 (file)
@@ -2159,7 +2159,8 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
        mgmt_device_disconnected(hdev, &conn->dst, conn->type, conn->dst_type,
                                reason, mgmt_connected);
 
-       if (conn->type == ACL_LINK && conn->flush_key)
+       if (conn->type == ACL_LINK &&
+           test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
                hci_remove_link_key(hdev, &conn->dst);
 
        params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
@@ -3145,7 +3146,10 @@ static void hci_link_key_notify_evt(struct hci_dev *hdev, struct sk_buff *skb)
                list_del(&key->list);
                kfree(key);
        } else if (conn) {
-               conn->flush_key = !persistent;
+               if (persistent)
+                       clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags);
+               else
+                       set_bit(HCI_CONN_FLUSH_KEY, &conn->flags);
        }
 
 unlock: