diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2015-02-18 07:53:57 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-02-19 02:44:29 -0500 |
commit | 539c496d88f7f96d42abde4e9d901c8f8167d615 (patch) | |
tree | b46fdad2015a84dc049766ae31f893e974a08c6a /include/net | |
parent | 354fe804edb29625eee6dd7b1f3c72b43392704d (diff) |
Bluetooth: Convert connect_cfm to be triggered through hci_cb
This patch moves all the connect_cfm callbacks to be based on the hci_cb
list. This means making l2cap_connect_cfm private to l2cap_core.c and
sco_connect_cb private to sco.c respectively. Since the hci_conn type
filtering isn't done any more on the wrapper level the callbacks
themselves need to check that they were passed a relevant type of
connection.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/bluetooth/hci_core.h | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 4a2db5e62699..0f00f0e9f257 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -503,13 +503,11 @@ extern struct mutex hci_cb_list_lock; | |||
503 | 503 | ||
504 | /* ----- HCI interface to upper protocols ----- */ | 504 | /* ----- HCI interface to upper protocols ----- */ |
505 | int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); | 505 | int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); |
506 | void l2cap_connect_cfm(struct hci_conn *hcon, u8 status); | ||
507 | int l2cap_disconn_ind(struct hci_conn *hcon); | 506 | int l2cap_disconn_ind(struct hci_conn *hcon); |
508 | void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); | 507 | void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); |
509 | int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags); | 508 | int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags); |
510 | 509 | ||
511 | int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); | 510 | int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); |
512 | void sco_connect_cfm(struct hci_conn *hcon, __u8 status); | ||
513 | void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); | 511 | void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); |
514 | int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); | 512 | int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); |
515 | 513 | ||
@@ -1050,28 +1048,6 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, | |||
1050 | } | 1048 | } |
1051 | } | 1049 | } |
1052 | 1050 | ||
1053 | static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) | ||
1054 | { | ||
1055 | switch (conn->type) { | ||
1056 | case ACL_LINK: | ||
1057 | case LE_LINK: | ||
1058 | l2cap_connect_cfm(conn, status); | ||
1059 | break; | ||
1060 | |||
1061 | case SCO_LINK: | ||
1062 | case ESCO_LINK: | ||
1063 | sco_connect_cfm(conn, status); | ||
1064 | break; | ||
1065 | |||
1066 | default: | ||
1067 | BT_ERR("unknown link type %d", conn->type); | ||
1068 | break; | ||
1069 | } | ||
1070 | |||
1071 | if (conn->connect_cfm_cb) | ||
1072 | conn->connect_cfm_cb(conn, status); | ||
1073 | } | ||
1074 | |||
1075 | static inline int hci_proto_disconn_ind(struct hci_conn *conn) | 1051 | static inline int hci_proto_disconn_ind(struct hci_conn *conn) |
1076 | { | 1052 | { |
1077 | if (conn->type != ACL_LINK && conn->type != LE_LINK) | 1053 | if (conn->type != ACL_LINK && conn->type != LE_LINK) |
@@ -1112,12 +1088,28 @@ struct hci_cb { | |||
1112 | 1088 | ||
1113 | char *name; | 1089 | char *name; |
1114 | 1090 | ||
1091 | void (*connect_cfm) (struct hci_conn *conn, __u8 status); | ||
1115 | void (*security_cfm) (struct hci_conn *conn, __u8 status, | 1092 | void (*security_cfm) (struct hci_conn *conn, __u8 status, |
1116 | __u8 encrypt); | 1093 | __u8 encrypt); |
1117 | void (*key_change_cfm) (struct hci_conn *conn, __u8 status); | 1094 | void (*key_change_cfm) (struct hci_conn *conn, __u8 status); |
1118 | void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); | 1095 | void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); |
1119 | }; | 1096 | }; |
1120 | 1097 | ||
1098 | static inline void hci_connect_cfm(struct hci_conn *conn, __u8 status) | ||
1099 | { | ||
1100 | struct hci_cb *cb; | ||
1101 | |||
1102 | mutex_lock(&hci_cb_list_lock); | ||
1103 | list_for_each_entry(cb, &hci_cb_list, list) { | ||
1104 | if (cb->connect_cfm) | ||
1105 | cb->connect_cfm(conn, status); | ||
1106 | } | ||
1107 | mutex_unlock(&hci_cb_list_lock); | ||
1108 | |||
1109 | if (conn->connect_cfm_cb) | ||
1110 | conn->connect_cfm_cb(conn, status); | ||
1111 | } | ||
1112 | |||
1121 | static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) | 1113 | static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) |
1122 | { | 1114 | { |
1123 | struct hci_cb *cb; | 1115 | struct hci_cb *cb; |