aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-05-20 02:45:50 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-05-20 11:44:14 -0400
commit4a74d65868f10dafe38765d4fe5bbf1e75f0623d (patch)
treefad735340e3c008f1ecce432dc8ed1214b93c1d4 /net
parent9dd4dd275f2e6dcef1f798118babcb5947f64497 (diff)
Bluetooth: Rename smp->smp_flags to smp->flags
There's no reason to have "smp" in this variable name since it is already part of the SMP struct which provides sufficient context. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/smp.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index efb73fdf710d..8d1a1903e458 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -59,7 +59,7 @@ struct smp_chan {
59 struct smp_ltk *ltk; 59 struct smp_ltk *ltk;
60 struct smp_ltk *slave_ltk; 60 struct smp_ltk *slave_ltk;
61 struct smp_irk *remote_irk; 61 struct smp_irk *remote_irk;
62 unsigned long smp_flags; 62 unsigned long flags;
63}; 63};
64 64
65static inline void swap128(const u8 src[16], u8 dst[16]) 65static inline void swap128(const u8 src[16], u8 dst[16])
@@ -396,7 +396,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
396 396
397 /* Initialize key for JUST WORKS */ 397 /* Initialize key for JUST WORKS */
398 memset(smp->tk, 0, sizeof(smp->tk)); 398 memset(smp->tk, 0, sizeof(smp->tk));
399 clear_bit(SMP_FLAG_TK_VALID, &smp->smp_flags); 399 clear_bit(SMP_FLAG_TK_VALID, &smp->flags);
400 400
401 BT_DBG("tk_request: auth:%d lcl:%d rem:%d", auth, local_io, remote_io); 401 BT_DBG("tk_request: auth:%d lcl:%d rem:%d", auth, local_io, remote_io);
402 402
@@ -415,19 +415,18 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
415 method = JUST_WORKS; 415 method = JUST_WORKS;
416 416
417 /* Don't confirm locally initiated pairing attempts */ 417 /* Don't confirm locally initiated pairing attempts */
418 if (method == JUST_CFM && test_bit(SMP_FLAG_INITIATOR, 418 if (method == JUST_CFM && test_bit(SMP_FLAG_INITIATOR, &smp->flags))
419 &smp->smp_flags))
420 method = JUST_WORKS; 419 method = JUST_WORKS;
421 420
422 /* If Just Works, Continue with Zero TK */ 421 /* If Just Works, Continue with Zero TK */
423 if (method == JUST_WORKS) { 422 if (method == JUST_WORKS) {
424 set_bit(SMP_FLAG_TK_VALID, &smp->smp_flags); 423 set_bit(SMP_FLAG_TK_VALID, &smp->flags);
425 return 0; 424 return 0;
426 } 425 }
427 426
428 /* Not Just Works/Confirm results in MITM Authentication */ 427 /* Not Just Works/Confirm results in MITM Authentication */
429 if (method != JUST_CFM) 428 if (method != JUST_CFM)
430 set_bit(SMP_FLAG_MITM_AUTH, &smp->smp_flags); 429 set_bit(SMP_FLAG_MITM_AUTH, &smp->flags);
431 430
432 /* If both devices have Keyoard-Display I/O, the master 431 /* If both devices have Keyoard-Display I/O, the master
433 * Confirms and the slave Enters the passkey. 432 * Confirms and the slave Enters the passkey.
@@ -446,7 +445,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
446 passkey %= 1000000; 445 passkey %= 1000000;
447 put_unaligned_le32(passkey, smp->tk); 446 put_unaligned_le32(passkey, smp->tk);
448 BT_DBG("PassKey: %d", passkey); 447 BT_DBG("PassKey: %d", passkey);
449 set_bit(SMP_FLAG_TK_VALID, &smp->smp_flags); 448 set_bit(SMP_FLAG_TK_VALID, &smp->flags);
450 } 449 }
451 450
452 hci_dev_lock(hcon->hdev); 451 hci_dev_lock(hcon->hdev);
@@ -494,7 +493,7 @@ static void smp_confirm(struct smp_chan *smp)
494 goto error; 493 goto error;
495 } 494 }
496 495
497 clear_bit(SMP_FLAG_CFM_PENDING, &smp->smp_flags); 496 clear_bit(SMP_FLAG_CFM_PENDING, &smp->flags);
498 497
499 smp_send_cmd(smp->conn, SMP_CMD_PAIRING_CONFIRM, sizeof(cp), &cp); 498 smp_send_cmd(smp->conn, SMP_CMD_PAIRING_CONFIRM, sizeof(cp), &cp);
500 499
@@ -605,7 +604,7 @@ void smp_chan_destroy(struct l2cap_conn *conn)
605 604
606 BUG_ON(!smp); 605 BUG_ON(!smp);
607 606
608 complete = test_bit(SMP_FLAG_COMPLETE, &smp->smp_flags); 607 complete = test_bit(SMP_FLAG_COMPLETE, &smp->flags);
609 mgmt_smp_complete(conn->hcon, complete); 608 mgmt_smp_complete(conn->hcon, complete);
610 609
611 kfree(smp->csrk); 610 kfree(smp->csrk);
@@ -656,7 +655,7 @@ int smp_user_confirm_reply(struct hci_conn *hcon, u16 mgmt_op, __le32 passkey)
656 put_unaligned_le32(value, smp->tk); 655 put_unaligned_le32(value, smp->tk);
657 /* Fall Through */ 656 /* Fall Through */
658 case MGMT_OP_USER_CONFIRM_REPLY: 657 case MGMT_OP_USER_CONFIRM_REPLY:
659 set_bit(SMP_FLAG_TK_VALID, &smp->smp_flags); 658 set_bit(SMP_FLAG_TK_VALID, &smp->flags);
660 break; 659 break;
661 case MGMT_OP_USER_PASSKEY_NEG_REPLY: 660 case MGMT_OP_USER_PASSKEY_NEG_REPLY:
662 case MGMT_OP_USER_CONFIRM_NEG_REPLY: 661 case MGMT_OP_USER_CONFIRM_NEG_REPLY:
@@ -668,7 +667,7 @@ int smp_user_confirm_reply(struct hci_conn *hcon, u16 mgmt_op, __le32 passkey)
668 } 667 }
669 668
670 /* If it is our turn to send Pairing Confirm, do so now */ 669 /* If it is our turn to send Pairing Confirm, do so now */
671 if (test_bit(SMP_FLAG_CFM_PENDING, &smp->smp_flags)) 670 if (test_bit(SMP_FLAG_CFM_PENDING, &smp->flags))
672 smp_confirm(smp); 671 smp_confirm(smp);
673 672
674 return 0; 673 return 0;
@@ -724,7 +723,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
724 if (ret) 723 if (ret)
725 return SMP_UNSPECIFIED; 724 return SMP_UNSPECIFIED;
726 725
727 clear_bit(SMP_FLAG_INITIATOR, &smp->smp_flags); 726 clear_bit(SMP_FLAG_INITIATOR, &smp->flags);
728 727
729 return 0; 728 return 0;
730} 729}
@@ -772,10 +771,10 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
772 if (ret) 771 if (ret)
773 return SMP_UNSPECIFIED; 772 return SMP_UNSPECIFIED;
774 773
775 set_bit(SMP_FLAG_CFM_PENDING, &smp->smp_flags); 774 set_bit(SMP_FLAG_CFM_PENDING, &smp->flags);
776 775
777 /* Can't compose response until we have been confirmed */ 776 /* Can't compose response until we have been confirmed */
778 if (test_bit(SMP_FLAG_TK_VALID, &smp->smp_flags)) 777 if (test_bit(SMP_FLAG_TK_VALID, &smp->flags))
779 smp_confirm(smp); 778 smp_confirm(smp);
780 779
781 return 0; 780 return 0;
@@ -796,10 +795,10 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb)
796 if (conn->hcon->out) 795 if (conn->hcon->out)
797 smp_send_cmd(conn, SMP_CMD_PAIRING_RANDOM, sizeof(smp->prnd), 796 smp_send_cmd(conn, SMP_CMD_PAIRING_RANDOM, sizeof(smp->prnd),
798 smp->prnd); 797 smp->prnd);
799 else if (test_bit(SMP_FLAG_TK_VALID, &smp->smp_flags)) 798 else if (test_bit(SMP_FLAG_TK_VALID, &smp->flags))
800 smp_confirm(smp); 799 smp_confirm(smp);
801 else 800 else
802 set_bit(SMP_FLAG_CFM_PENDING, &smp->smp_flags); 801 set_bit(SMP_FLAG_CFM_PENDING, &smp->flags);
803 802
804 return 0; 803 return 0;
805} 804}
@@ -878,7 +877,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
878 877
879 smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp); 878 smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp);
880 879
881 clear_bit(SMP_FLAG_INITIATOR, &smp->smp_flags); 880 clear_bit(SMP_FLAG_INITIATOR, &smp->flags);
882 881
883 return 0; 882 return 0;
884} 883}
@@ -945,7 +944,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
945 smp_send_cmd(conn, SMP_CMD_SECURITY_REQ, sizeof(cp), &cp); 944 smp_send_cmd(conn, SMP_CMD_SECURITY_REQ, sizeof(cp), &cp);
946 } 945 }
947 946
948 set_bit(SMP_FLAG_INITIATOR, &smp->smp_flags); 947 set_bit(SMP_FLAG_INITIATOR, &smp->flags);
949 948
950done: 949done:
951 hcon->pending_sec_level = sec_level; 950 hcon->pending_sec_level = sec_level;
@@ -1375,7 +1374,7 @@ int smp_distribute_keys(struct l2cap_conn *conn)
1375 1374
1376 clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags); 1375 clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags);
1377 cancel_delayed_work_sync(&conn->security_timer); 1376 cancel_delayed_work_sync(&conn->security_timer);
1378 set_bit(SMP_FLAG_COMPLETE, &smp->smp_flags); 1377 set_bit(SMP_FLAG_COMPLETE, &smp->flags);
1379 smp_notify_keys(conn); 1378 smp_notify_keys(conn);
1380 1379
1381 smp_chan_destroy(conn); 1380 smp_chan_destroy(conn);