aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_conn.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-01-18 14:33:12 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 10:01:29 -0500
commitaa64a8b500e61c33c17f1d5e7de0cc154489c59e (patch)
tree4cc269f37f27cd9796664fe4987168dfa9f74742 /net/bluetooth/hci_conn.c
parent84bde9d6c0e6830f4a8685a5d237965053118bf9 (diff)
Bluetooth: Add a convenience function to check for SSP enabled
It's a very common test to see if both the local and the remote device have SSP enabled. By creating a simple function to test this we can shorten many if-statements in the code. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r--net/bluetooth/hci_conn.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 6ec259e84b95..eae7a53467ef 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -608,9 +608,7 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
608{ 608{
609 BT_DBG("conn %p", conn); 609 BT_DBG("conn %p", conn);
610 610
611 if (test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) && 611 if (hci_conn_ssp_enabled(conn) && !(conn->link_mode & HCI_LM_ENCRYPT))
612 test_bit(HCI_SSP_ENABLED, &conn->hdev->dev_flags) &&
613 !(conn->link_mode & HCI_LM_ENCRYPT))
614 return 0; 612 return 0;
615 613
616 return 1; 614 return 1;
@@ -672,9 +670,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
672 670
673 /* For non 2.1 devices and low security level we don't need the link 671 /* For non 2.1 devices and low security level we don't need the link
674 key. */ 672 key. */
675 if (sec_level == BT_SECURITY_LOW && 673 if (sec_level == BT_SECURITY_LOW && !hci_conn_ssp_enabled(conn))
676 (!test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) ||
677 !test_bit(HCI_SSP_ENABLED, &conn->hdev->dev_flags)))
678 return 1; 674 return 1;
679 675
680 /* For other security levels we need the link key. */ 676 /* For other security levels we need the link key. */