aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-01-15 23:10:31 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 10:01:28 -0500
commit51a8efd7d02c13cb1c6fdd1cd66788792a3fcc7c (patch)
tree819b6bfcb3b898be27d67a942d75aafbc10f24c5 /net/bluetooth
parent1dc06093a9f353ef19b7b5180602884d0ce065c5 (diff)
Bluetooth: Rename conn->pend to conn->flags
These flags can and will be used for more general purpose values than just pending state transitions so the more common name "flags" makes more sense than "pend". Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_conn.c20
-rw-r--r--net/bluetooth/hci_event.c36
-rw-r--r--net/bluetooth/l2cap_core.c2
-rw-r--r--net/bluetooth/smp.c19
4 files changed, 38 insertions, 39 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 3db432473ad5..8a4678a2c982 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -337,7 +337,7 @@ static void hci_conn_enter_sniff_mode(struct hci_conn *conn)
337 hci_send_cmd(hdev, HCI_OP_SNIFF_SUBRATE, sizeof(cp), &cp); 337 hci_send_cmd(hdev, HCI_OP_SNIFF_SUBRATE, sizeof(cp), &cp);
338 } 338 }
339 339
340 if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) { 340 if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags)) {
341 struct hci_cp_sniff_mode cp; 341 struct hci_cp_sniff_mode cp;
342 cp.handle = cpu_to_le16(conn->handle); 342 cp.handle = cpu_to_le16(conn->handle);
343 cp.max_interval = cpu_to_le16(hdev->sniff_max_interval); 343 cp.max_interval = cpu_to_le16(hdev->sniff_max_interval);
@@ -589,9 +589,9 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
589 acl->power_save = 1; 589 acl->power_save = 1;
590 hci_conn_enter_active_mode(acl, BT_POWER_FORCE_ACTIVE_ON); 590 hci_conn_enter_active_mode(acl, BT_POWER_FORCE_ACTIVE_ON);
591 591
592 if (test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->pend)) { 592 if (test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->flags)) {
593 /* defer SCO setup until mode change completed */ 593 /* defer SCO setup until mode change completed */
594 set_bit(HCI_CONN_SCO_SETUP_PEND, &acl->pend); 594 set_bit(HCI_CONN_SCO_SETUP_PEND, &acl->flags);
595 return sco; 595 return sco;
596 } 596 }
597 597
@@ -633,13 +633,13 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
633 633
634 conn->auth_type = auth_type; 634 conn->auth_type = auth_type;
635 635
636 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { 636 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
637 struct hci_cp_auth_requested cp; 637 struct hci_cp_auth_requested cp;
638 cp.handle = cpu_to_le16(conn->handle); 638 cp.handle = cpu_to_le16(conn->handle);
639 hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, 639 hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED,
640 sizeof(cp), &cp); 640 sizeof(cp), &cp);
641 if (conn->key_type != 0xff) 641 if (conn->key_type != 0xff)
642 set_bit(HCI_CONN_REAUTH_PEND, &conn->pend); 642 set_bit(HCI_CONN_REAUTH_PEND, &conn->flags);
643 } 643 }
644 644
645 return 0; 645 return 0;
@@ -650,7 +650,7 @@ static void hci_conn_encrypt(struct hci_conn *conn)
650{ 650{
651 BT_DBG("conn %p", conn); 651 BT_DBG("conn %p", conn);
652 652
653 if (!test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) { 653 if (!test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) {
654 struct hci_cp_set_conn_encrypt cp; 654 struct hci_cp_set_conn_encrypt cp;
655 cp.handle = cpu_to_le16(conn->handle); 655 cp.handle = cpu_to_le16(conn->handle);
656 cp.encrypt = 0x01; 656 cp.encrypt = 0x01;
@@ -700,7 +700,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
700 goto encrypt; 700 goto encrypt;
701 701
702auth: 702auth:
703 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) 703 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
704 return 0; 704 return 0;
705 705
706 if (!hci_conn_auth(conn, sec_level, auth_type)) 706 if (!hci_conn_auth(conn, sec_level, auth_type))
@@ -735,7 +735,7 @@ int hci_conn_change_link_key(struct hci_conn *conn)
735{ 735{
736 BT_DBG("conn %p", conn); 736 BT_DBG("conn %p", conn);
737 737
738 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { 738 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
739 struct hci_cp_change_conn_link_key cp; 739 struct hci_cp_change_conn_link_key cp;
740 cp.handle = cpu_to_le16(conn->handle); 740 cp.handle = cpu_to_le16(conn->handle);
741 hci_send_cmd(conn->hdev, HCI_OP_CHANGE_CONN_LINK_KEY, 741 hci_send_cmd(conn->hdev, HCI_OP_CHANGE_CONN_LINK_KEY,
@@ -754,7 +754,7 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role)
754 if (!role && conn->link_mode & HCI_LM_MASTER) 754 if (!role && conn->link_mode & HCI_LM_MASTER)
755 return 1; 755 return 1;
756 756
757 if (!test_and_set_bit(HCI_CONN_RSWITCH_PEND, &conn->pend)) { 757 if (!test_and_set_bit(HCI_CONN_RSWITCH_PEND, &conn->flags)) {
758 struct hci_cp_switch_role cp; 758 struct hci_cp_switch_role cp;
759 bacpy(&cp.bdaddr, &conn->dst); 759 bacpy(&cp.bdaddr, &conn->dst);
760 cp.role = role; 760 cp.role = role;
@@ -781,7 +781,7 @@ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active)
781 if (!conn->power_save && !force_active) 781 if (!conn->power_save && !force_active)
782 goto timer; 782 goto timer;
783 783
784 if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) { 784 if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags)) {
785 struct hci_cp_exit_sniff_mode cp; 785 struct hci_cp_exit_sniff_mode cp;
786 cp.handle = cpu_to_le16(conn->handle); 786 cp.handle = cpu_to_le16(conn->handle);
787 hci_send_cmd(hdev, HCI_OP_EXIT_SNIFF_MODE, sizeof(cp), &cp); 787 hci_send_cmd(hdev, HCI_OP_EXIT_SNIFF_MODE, sizeof(cp), &cp);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index e93afebdcf84..d9a8618ae156 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1344,7 +1344,7 @@ static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status)
1344 if (!hci_outgoing_auth_needed(hdev, conn)) 1344 if (!hci_outgoing_auth_needed(hdev, conn))
1345 goto unlock; 1345 goto unlock;
1346 1346
1347 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { 1347 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
1348 struct hci_cp_auth_requested cp; 1348 struct hci_cp_auth_requested cp;
1349 cp.handle = __cpu_to_le16(conn->handle); 1349 cp.handle = __cpu_to_le16(conn->handle);
1350 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); 1350 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
@@ -1461,9 +1461,9 @@ static void hci_cs_sniff_mode(struct hci_dev *hdev, __u8 status)
1461 1461
1462 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); 1462 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle));
1463 if (conn) { 1463 if (conn) {
1464 clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend); 1464 clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags);
1465 1465
1466 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->pend)) 1466 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags))
1467 hci_sco_setup(conn, status); 1467 hci_sco_setup(conn, status);
1468 } 1468 }
1469 1469
@@ -1488,9 +1488,9 @@ static void hci_cs_exit_sniff_mode(struct hci_dev *hdev, __u8 status)
1488 1488
1489 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); 1489 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle));
1490 if (conn) { 1490 if (conn) {
1491 clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend); 1491 clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags);
1492 1492
1493 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->pend)) 1493 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags))
1494 hci_sco_setup(conn, status); 1494 hci_sco_setup(conn, status);
1495 } 1495 }
1496 1496
@@ -1817,7 +1817,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
1817 1817
1818 if (!ev->status) { 1818 if (!ev->status) {
1819 if (!(conn->ssp_mode > 0 && hdev->ssp_mode > 0) && 1819 if (!(conn->ssp_mode > 0 && hdev->ssp_mode > 0) &&
1820 test_bit(HCI_CONN_REAUTH_PEND, &conn->pend)) { 1820 test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) {
1821 BT_INFO("re-auth of legacy device is not possible."); 1821 BT_INFO("re-auth of legacy device is not possible.");
1822 } else { 1822 } else {
1823 conn->link_mode |= HCI_LM_AUTH; 1823 conn->link_mode |= HCI_LM_AUTH;
@@ -1827,8 +1827,8 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
1827 mgmt_auth_failed(hdev, &conn->dst, ev->status); 1827 mgmt_auth_failed(hdev, &conn->dst, ev->status);
1828 } 1828 }
1829 1829
1830 clear_bit(HCI_CONN_AUTH_PEND, &conn->pend); 1830 clear_bit(HCI_CONN_AUTH_PEND, &conn->flags);
1831 clear_bit(HCI_CONN_REAUTH_PEND, &conn->pend); 1831 clear_bit(HCI_CONN_REAUTH_PEND, &conn->flags);
1832 1832
1833 if (conn->state == BT_CONFIG) { 1833 if (conn->state == BT_CONFIG) {
1834 if (!ev->status && hdev->ssp_mode > 0 && conn->ssp_mode > 0) { 1834 if (!ev->status && hdev->ssp_mode > 0 && conn->ssp_mode > 0) {
@@ -1850,7 +1850,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
1850 hci_conn_put(conn); 1850 hci_conn_put(conn);
1851 } 1851 }
1852 1852
1853 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) { 1853 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) {
1854 if (!ev->status) { 1854 if (!ev->status) {
1855 struct hci_cp_set_conn_encrypt cp; 1855 struct hci_cp_set_conn_encrypt cp;
1856 cp.handle = ev->handle; 1856 cp.handle = ev->handle;
@@ -1858,7 +1858,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
1858 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp), 1858 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp),
1859 &cp); 1859 &cp);
1860 } else { 1860 } else {
1861 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend); 1861 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
1862 hci_encrypt_cfm(conn, ev->status, 0x00); 1862 hci_encrypt_cfm(conn, ev->status, 0x00);
1863 } 1863 }
1864 } 1864 }
@@ -1892,7 +1892,7 @@ static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb
1892 if (!hci_outgoing_auth_needed(hdev, conn)) 1892 if (!hci_outgoing_auth_needed(hdev, conn))
1893 goto unlock; 1893 goto unlock;
1894 1894
1895 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { 1895 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
1896 struct hci_cp_auth_requested cp; 1896 struct hci_cp_auth_requested cp;
1897 cp.handle = __cpu_to_le16(conn->handle); 1897 cp.handle = __cpu_to_le16(conn->handle);
1898 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); 1898 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
@@ -1923,7 +1923,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
1923 conn->link_mode &= ~HCI_LM_ENCRYPT; 1923 conn->link_mode &= ~HCI_LM_ENCRYPT;
1924 } 1924 }
1925 1925
1926 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend); 1926 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
1927 1927
1928 if (conn->state == BT_CONFIG) { 1928 if (conn->state == BT_CONFIG) {
1929 if (!ev->status) 1929 if (!ev->status)
@@ -1952,7 +1952,7 @@ static inline void hci_change_link_key_complete_evt(struct hci_dev *hdev, struct
1952 if (!ev->status) 1952 if (!ev->status)
1953 conn->link_mode |= HCI_LM_SECURE; 1953 conn->link_mode |= HCI_LM_SECURE;
1954 1954
1955 clear_bit(HCI_CONN_AUTH_PEND, &conn->pend); 1955 clear_bit(HCI_CONN_AUTH_PEND, &conn->flags);
1956 1956
1957 hci_key_change_cfm(conn, ev->status); 1957 hci_key_change_cfm(conn, ev->status);
1958 } 1958 }
@@ -2336,7 +2336,7 @@ static inline void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb
2336 conn->link_mode |= HCI_LM_MASTER; 2336 conn->link_mode |= HCI_LM_MASTER;
2337 } 2337 }
2338 2338
2339 clear_bit(HCI_CONN_RSWITCH_PEND, &conn->pend); 2339 clear_bit(HCI_CONN_RSWITCH_PEND, &conn->flags);
2340 2340
2341 hci_role_switch_cfm(conn, ev->status, ev->role); 2341 hci_role_switch_cfm(conn, ev->status, ev->role);
2342 } 2342 }
@@ -2474,14 +2474,14 @@ static inline void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb
2474 conn->mode = ev->mode; 2474 conn->mode = ev->mode;
2475 conn->interval = __le16_to_cpu(ev->interval); 2475 conn->interval = __le16_to_cpu(ev->interval);
2476 2476
2477 if (!test_and_clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) { 2477 if (!test_and_clear_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags)) {
2478 if (conn->mode == HCI_CM_ACTIVE) 2478 if (conn->mode == HCI_CM_ACTIVE)
2479 conn->power_save = 1; 2479 conn->power_save = 1;
2480 else 2480 else
2481 conn->power_save = 0; 2481 conn->power_save = 0;
2482 } 2482 }
2483 2483
2484 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->pend)) 2484 if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->flags))
2485 hci_sco_setup(conn, ev->status); 2485 hci_sco_setup(conn, ev->status);
2486 } 2486 }
2487 2487
@@ -3013,7 +3013,7 @@ static inline void hci_user_confirm_request_evt(struct hci_dev *hdev,
3013 /* If we're not the initiators request authorization to 3013 /* If we're not the initiators request authorization to
3014 * proceed from user space (mgmt_user_confirm with 3014 * proceed from user space (mgmt_user_confirm with
3015 * confirm_hint set to 1). */ 3015 * confirm_hint set to 1). */
3016 if (!test_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { 3016 if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
3017 BT_DBG("Confirming auto-accept as acceptor"); 3017 BT_DBG("Confirming auto-accept as acceptor");
3018 confirm_hint = 1; 3018 confirm_hint = 1;
3019 goto confirm; 3019 goto confirm;
@@ -3074,7 +3074,7 @@ static inline void hci_simple_pair_complete_evt(struct hci_dev *hdev, struct sk_
3074 * initiated the authentication. A traditional auth_complete 3074 * initiated the authentication. A traditional auth_complete
3075 * event gets always produced as initiator and is also mapped to 3075 * event gets always produced as initiator and is also mapped to
3076 * the mgmt_auth_failed event */ 3076 * the mgmt_auth_failed event */
3077 if (!test_bit(HCI_CONN_AUTH_PEND, &conn->pend) && ev->status != 0) 3077 if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && ev->status != 0)
3078 mgmt_auth_failed(hdev, &conn->dst, ev->status); 3078 mgmt_auth_failed(hdev, &conn->dst, ev->status);
3079 3079
3080 hci_conn_put(conn); 3080 hci_conn_put(conn);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index a66e5ec9adef..27b72d954436 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1020,7 +1020,7 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
1020 if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) 1020 if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT)
1021 __cancel_delayed_work(&conn->info_timer); 1021 __cancel_delayed_work(&conn->info_timer);
1022 1022
1023 if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) { 1023 if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) {
1024 __cancel_delayed_work(&conn->security_timer); 1024 __cancel_delayed_work(&conn->security_timer);
1025 smp_chan_destroy(conn); 1025 smp_chan_destroy(conn);
1026 } 1026 }
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 65a90242d990..e08fe6c9c9c9 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -261,7 +261,7 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send)
261 smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason), 261 smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason),
262 &reason); 262 &reason);
263 263
264 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->pend); 264 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->flags);
265 mgmt_auth_failed(conn->hcon->hdev, conn->dst, reason); 265 mgmt_auth_failed(conn->hcon->hdev, conn->dst, reason);
266 cancel_delayed_work_sync(&conn->security_timer); 266 cancel_delayed_work_sync(&conn->security_timer);
267 smp_chan_destroy(conn); 267 smp_chan_destroy(conn);
@@ -449,7 +449,7 @@ static void random_work(struct work_struct *work)
449 memset(stk + smp->smp_key_size, 0, 449 memset(stk + smp->smp_key_size, 0,
450 SMP_MAX_ENC_KEY_SIZE - smp->smp_key_size); 450 SMP_MAX_ENC_KEY_SIZE - smp->smp_key_size);
451 451
452 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->pend)) { 452 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) {
453 reason = SMP_UNSPECIFIED; 453 reason = SMP_UNSPECIFIED;
454 goto error; 454 goto error;
455 } 455 }
@@ -506,7 +506,7 @@ void smp_chan_destroy(struct l2cap_conn *conn)
506{ 506{
507 struct smp_chan *smp = conn->smp_chan; 507 struct smp_chan *smp = conn->smp_chan;
508 508
509 clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->pend); 509 clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags);
510 510
511 if (smp->tfm) 511 if (smp->tfm)
512 crypto_free_blkcipher(smp->tfm); 512 crypto_free_blkcipher(smp->tfm);
@@ -571,7 +571,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
571 if (conn->hcon->link_mode & HCI_LM_MASTER) 571 if (conn->hcon->link_mode & HCI_LM_MASTER)
572 return SMP_CMD_NOTSUPP; 572 return SMP_CMD_NOTSUPP;
573 573
574 if (!test_and_set_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->pend)) 574 if (!test_and_set_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags))
575 smp = smp_chan_create(conn); 575 smp = smp_chan_create(conn);
576 576
577 smp = conn->smp_chan; 577 smp = conn->smp_chan;
@@ -707,8 +707,7 @@ static u8 smp_ltk_encrypt(struct l2cap_conn *conn)
707 if (!key) 707 if (!key)
708 return 0; 708 return 0;
709 709
710 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, 710 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags))
711 &hcon->pend))
712 return 1; 711 return 1;
713 712
714 master = (void *) key->data; 713 master = (void *) key->data;
@@ -733,7 +732,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
733 if (smp_ltk_encrypt(conn)) 732 if (smp_ltk_encrypt(conn))
734 return 0; 733 return 0;
735 734
736 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) 735 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
737 return 0; 736 return 0;
738 737
739 smp = smp_chan_create(conn); 738 smp = smp_chan_create(conn);
@@ -772,7 +771,7 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)
772 if (smp_ltk_encrypt(conn)) 771 if (smp_ltk_encrypt(conn))
773 goto done; 772 goto done;
774 773
775 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) 774 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
776 return 0; 775 return 0;
777 776
778 smp = smp_chan_create(conn); 777 smp = smp_chan_create(conn);
@@ -908,7 +907,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
908 907
909 BT_DBG("conn %p force %d", conn, force); 908 BT_DBG("conn %p force %d", conn, force);
910 909
911 if (!test_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->pend)) 910 if (!test_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags))
912 return 0; 911 return 0;
913 912
914 rsp = (void *) &smp->prsp[1]; 913 rsp = (void *) &smp->prsp[1];
@@ -982,7 +981,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
982 } 981 }
983 982
984 if (conn->hcon->out || force) { 983 if (conn->hcon->out || force) {
985 clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->pend); 984 clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags);
986 cancel_delayed_work_sync(&conn->security_timer); 985 cancel_delayed_work_sync(&conn->security_timer);
987 smp_chan_destroy(conn); 986 smp_chan_destroy(conn);
988 } 987 }