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_conn.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_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index a707d19ee44e..8288e303621a 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -105,7 +105,8 @@ void hci_acl_connect(struct hci_conn *conn) | |||
105 | } | 105 | } |
106 | 106 | ||
107 | memcpy(conn->dev_class, ie->data.dev_class, 3); | 107 | memcpy(conn->dev_class, ie->data.dev_class, 3); |
108 | conn->ssp_mode = ie->data.ssp_mode; | 108 | if (ie->data.ssp_mode > 0) |
109 | set_bit(HCI_CONN_SSP_ENABLED, &conn->flags); | ||
109 | } | 110 | } |
110 | 111 | ||
111 | cp.pkt_type = cpu_to_le16(conn->pkt_type); | 112 | cp.pkt_type = cpu_to_le16(conn->pkt_type); |
@@ -386,7 +387,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) | |||
386 | conn->remote_auth = 0xff; | 387 | conn->remote_auth = 0xff; |
387 | conn->key_type = 0xff; | 388 | conn->key_type = 0xff; |
388 | 389 | ||
389 | conn->power_save = 1; | 390 | set_bit(HCI_CONN_POWER_SAVE, &conn->flags); |
390 | conn->disc_timeout = HCI_DISCONN_TIMEOUT; | 391 | conn->disc_timeout = HCI_DISCONN_TIMEOUT; |
391 | 392 | ||
392 | switch (type) { | 393 | switch (type) { |
@@ -586,7 +587,7 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 | |||
586 | 587 | ||
587 | if (acl->state == BT_CONNECTED && | 588 | if (acl->state == BT_CONNECTED && |
588 | (sco->state == BT_OPEN || sco->state == BT_CLOSED)) { | 589 | (sco->state == BT_OPEN || sco->state == BT_CLOSED)) { |
589 | acl->power_save = 1; | 590 | set_bit(HCI_CONN_POWER_SAVE, &acl->flags); |
590 | hci_conn_enter_active_mode(acl, BT_POWER_FORCE_ACTIVE_ON); | 591 | hci_conn_enter_active_mode(acl, BT_POWER_FORCE_ACTIVE_ON); |
591 | 592 | ||
592 | if (test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->flags)) { | 593 | if (test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->flags)) { |
@@ -607,7 +608,8 @@ int hci_conn_check_link_mode(struct hci_conn *conn) | |||
607 | { | 608 | { |
608 | BT_DBG("conn %p", conn); | 609 | BT_DBG("conn %p", conn); |
609 | 610 | ||
610 | if (conn->ssp_mode > 0 && conn->hdev->ssp_mode > 0 && | 611 | if (test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) && |
612 | conn->hdev->ssp_mode > 0 && | ||
611 | !(conn->link_mode & HCI_LM_ENCRYPT)) | 613 | !(conn->link_mode & HCI_LM_ENCRYPT)) |
612 | return 0; | 614 | return 0; |
613 | 615 | ||
@@ -671,7 +673,8 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
671 | /* For non 2.1 devices and low security level we don't need the link | 673 | /* For non 2.1 devices and low security level we don't need the link |
672 | key. */ | 674 | key. */ |
673 | if (sec_level == BT_SECURITY_LOW && | 675 | if (sec_level == BT_SECURITY_LOW && |
674 | (!conn->ssp_mode || !conn->hdev->ssp_mode)) | 676 | (!test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) || |
677 | !conn->hdev->ssp_mode)) | ||
675 | return 1; | 678 | return 1; |
676 | 679 | ||
677 | /* For other security levels we need the link key. */ | 680 | /* For other security levels we need the link key. */ |
@@ -778,7 +781,7 @@ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active) | |||
778 | if (conn->mode != HCI_CM_SNIFF) | 781 | if (conn->mode != HCI_CM_SNIFF) |
779 | goto timer; | 782 | goto timer; |
780 | 783 | ||
781 | if (!conn->power_save && !force_active) | 784 | if (!test_bit(HCI_CONN_POWER_SAVE, &conn->flags) && !force_active) |
782 | goto timer; | 785 | goto timer; |
783 | 786 | ||
784 | if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags)) { | 787 | if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags)) { |