diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-01-15 23:47:28 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-13 10:01:28 -0500 |
commit | 58a681ef1455aef9caad1d41073868fb399373f6 (patch) | |
tree | af78e12c2fff312aebaee55029bceefd6311e432 /net/bluetooth/hci_event.c | |
parent | b644ba33699711630099efc58a4efc225560aceb (diff) |
Bluetooth: Merge boolean members of struct hci_conn into flags
Now that the flags member of struct hci_conn is supposed to accommodate
any boolean type values we can easily merge all boolean members into it.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index f0b08ab734d7..02ad53801732 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1264,7 +1264,8 @@ static int hci_outgoing_auth_needed(struct hci_dev *hdev, | |||
1264 | 1264 | ||
1265 | /* Only request authentication for SSP connections or non-SSP | 1265 | /* Only request authentication for SSP connections or non-SSP |
1266 | * devices with sec_level HIGH or if MITM protection is requested */ | 1266 | * devices with sec_level HIGH or if MITM protection is requested */ |
1267 | if (!(hdev->ssp_mode > 0 && conn->ssp_mode > 0) && | 1267 | if (!(hdev->ssp_mode > 0 && |
1268 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)) && | ||
1268 | conn->pending_sec_level != BT_SECURITY_HIGH && | 1269 | conn->pending_sec_level != BT_SECURITY_HIGH && |
1269 | !(conn->auth_type & 0x01)) | 1270 | !(conn->auth_type & 0x01)) |
1270 | return 0; | 1271 | return 0; |
@@ -1838,7 +1839,8 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s | |||
1838 | goto unlock; | 1839 | goto unlock; |
1839 | 1840 | ||
1840 | if (!ev->status) { | 1841 | if (!ev->status) { |
1841 | if (!(conn->ssp_mode > 0 && hdev->ssp_mode > 0) && | 1842 | if (!(test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) && |
1843 | hdev->ssp_mode > 0) && | ||
1842 | test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) { | 1844 | test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) { |
1843 | BT_INFO("re-auth of legacy device is not possible."); | 1845 | BT_INFO("re-auth of legacy device is not possible."); |
1844 | } else { | 1846 | } else { |
@@ -1853,7 +1855,8 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s | |||
1853 | clear_bit(HCI_CONN_REAUTH_PEND, &conn->flags); | 1855 | clear_bit(HCI_CONN_REAUTH_PEND, &conn->flags); |
1854 | 1856 | ||
1855 | if (conn->state == BT_CONFIG) { | 1857 | if (conn->state == BT_CONFIG) { |
1856 | if (!ev->status && hdev->ssp_mode > 0 && conn->ssp_mode > 0) { | 1858 | if (!ev->status && hdev->ssp_mode > 0 && |
1859 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)) { | ||
1857 | struct hci_cp_set_conn_encrypt cp; | 1860 | struct hci_cp_set_conn_encrypt cp; |
1858 | cp.handle = ev->handle; | 1861 | cp.handle = ev->handle; |
1859 | cp.encrypt = 0x01; | 1862 | cp.encrypt = 0x01; |
@@ -2505,9 +2508,9 @@ static inline void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb | |||
2505 | 2508 | ||
2506 | if (!test_and_clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags)) { | 2509 | if (!test_and_clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags)) { |
2507 | if (conn->mode == HCI_CM_ACTIVE) | 2510 | if (conn->mode == HCI_CM_ACTIVE) |
2508 | conn->power_save = 1; | 2511 | set_bit(HCI_CONN_POWER_SAVE, &conn->flags); |
2509 | else | 2512 | else |
2510 | conn->power_save = 0; | 2513 | clear_bit(HCI_CONN_POWER_SAVE, &conn->flags); |
2511 | } | 2514 | } |
2512 | 2515 | ||
2513 | if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags)) | 2516 | if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags)) |
@@ -2780,7 +2783,8 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b | |||
2780 | if (ie) | 2783 | if (ie) |
2781 | ie->data.ssp_mode = (ev->features[0] & 0x01); | 2784 | ie->data.ssp_mode = (ev->features[0] & 0x01); |
2782 | 2785 | ||
2783 | conn->ssp_mode = (ev->features[0] & 0x01); | 2786 | if (ev->features[0] & 0x01) |
2787 | set_bit(HCI_CONN_SSP_ENABLED, &conn->flags); | ||
2784 | } | 2788 | } |
2785 | 2789 | ||
2786 | if (conn->state != BT_CONFIG) | 2790 | if (conn->state != BT_CONFIG) |
@@ -2962,7 +2966,7 @@ static inline void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff | |||
2962 | conn->auth_type = hci_get_auth_req(conn); | 2966 | conn->auth_type = hci_get_auth_req(conn); |
2963 | cp.authentication = conn->auth_type; | 2967 | cp.authentication = conn->auth_type; |
2964 | 2968 | ||
2965 | if ((conn->out == 0x01 || conn->remote_oob == 0x01) && | 2969 | if ((conn->out || test_bit(HCI_CONN_REMOTE_OOB, &conn->flags)) && |
2966 | hci_find_remote_oob_data(hdev, &conn->dst)) | 2970 | hci_find_remote_oob_data(hdev, &conn->dst)) |
2967 | cp.oob_data = 0x01; | 2971 | cp.oob_data = 0x01; |
2968 | else | 2972 | else |
@@ -2998,8 +3002,9 @@ static inline void hci_io_capa_reply_evt(struct hci_dev *hdev, struct sk_buff *s | |||
2998 | goto unlock; | 3002 | goto unlock; |
2999 | 3003 | ||
3000 | conn->remote_cap = ev->capability; | 3004 | conn->remote_cap = ev->capability; |
3001 | conn->remote_oob = ev->oob_data; | ||
3002 | conn->remote_auth = ev->authentication; | 3005 | conn->remote_auth = ev->authentication; |
3006 | if (ev->oob_data) | ||
3007 | set_bit(HCI_CONN_REMOTE_OOB, &conn->flags); | ||
3003 | 3008 | ||
3004 | unlock: | 3009 | unlock: |
3005 | hci_dev_unlock(hdev); | 3010 | hci_dev_unlock(hdev); |