diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-07-16 04:42:27 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-16 05:04:23 -0400 |
commit | 40bef302f6323d1ee6fb3dc0e62edb0f446d0339 (patch) | |
tree | 2b77646a8adf90560b66e7f72df64ab4cc76240e /net/bluetooth/hci_conn.c | |
parent | ba165a90b59812ab1d9cd2943fd104cfc25c601e (diff) |
Bluetooth: Convert HCI_CONN_MASTER flag to a conn->role variable
Having a dedicated u8 role variable in the hci_conn struct greatly
simplifies tracking of the role, since this is the native way that it's
represented on the HCI level.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 490ee8846d9e..6c1c5048984c 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -66,8 +66,7 @@ static void hci_acl_create_connection(struct hci_conn *conn) | |||
66 | 66 | ||
67 | conn->state = BT_CONNECT; | 67 | conn->state = BT_CONNECT; |
68 | conn->out = true; | 68 | conn->out = true; |
69 | 69 | conn->role = HCI_ROLE_MASTER; | |
70 | set_bit(HCI_CONN_MASTER, &conn->flags); | ||
71 | 70 | ||
72 | conn->attempt++; | 71 | conn->attempt++; |
73 | 72 | ||
@@ -335,7 +334,7 @@ static void hci_conn_timeout(struct work_struct *work) | |||
335 | * event handling and hci_clock_offset_evt function. | 334 | * event handling and hci_clock_offset_evt function. |
336 | */ | 335 | */ |
337 | if (conn->type == ACL_LINK && | 336 | if (conn->type == ACL_LINK && |
338 | test_bit(HCI_CONN_MASTER, &conn->flags)) { | 337 | conn->role == HCI_ROLE_MASTER) { |
339 | struct hci_dev *hdev = conn->hdev; | 338 | struct hci_dev *hdev = conn->hdev; |
340 | struct hci_cp_read_clock_offset cp; | 339 | struct hci_cp_read_clock_offset cp; |
341 | 340 | ||
@@ -786,8 +785,8 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, | |||
786 | goto create_conn; | 785 | goto create_conn; |
787 | } | 786 | } |
788 | 787 | ||
789 | conn->out = true; | 788 | conn->out = true; |
790 | set_bit(HCI_CONN_MASTER, &conn->flags); | 789 | conn->role = HCI_ROLE_MASTER; |
791 | 790 | ||
792 | params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); | 791 | params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); |
793 | if (params) { | 792 | if (params) { |
@@ -1076,7 +1075,7 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role) | |||
1076 | { | 1075 | { |
1077 | BT_DBG("hcon %p", conn); | 1076 | BT_DBG("hcon %p", conn); |
1078 | 1077 | ||
1079 | if (!role && test_bit(HCI_CONN_MASTER, &conn->flags)) | 1078 | if (role == conn->role) |
1080 | return 1; | 1079 | return 1; |
1081 | 1080 | ||
1082 | if (!test_and_set_bit(HCI_CONN_RSWITCH_PEND, &conn->flags)) { | 1081 | if (!test_and_set_bit(HCI_CONN_RSWITCH_PEND, &conn->flags)) { |
@@ -1151,7 +1150,7 @@ static u32 get_link_mode(struct hci_conn *conn) | |||
1151 | { | 1150 | { |
1152 | u32 link_mode = 0; | 1151 | u32 link_mode = 0; |
1153 | 1152 | ||
1154 | if (test_bit(HCI_CONN_MASTER, &conn->flags)) | 1153 | if (conn->role == HCI_ROLE_MASTER) |
1155 | link_mode |= HCI_LM_MASTER; | 1154 | link_mode |= HCI_LM_MASTER; |
1156 | 1155 | ||
1157 | if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) | 1156 | if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) |