aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-02-18 07:53:58 -0500
committerMarcel Holtmann <marcel@holtmann.org>2015-02-19 02:44:29 -0500
commit3a6d576be9fe02b0c3ffa89ef6eac048e14eec84 (patch)
tree70bcc5b6861fe48521d9aab181c8d7e0db15c5de /include/net
parent539c496d88f7f96d42abde4e9d901c8f8167d615 (diff)
Bluetooth: Convert disconn_cfm to be triggered through hci_cb
This patch moves all the disconn_cfm callbacks to be based on the hci_cb list. This means making l2cap_disconn_cfm private to l2cap_core.c and sco_conn_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.h44
1 files changed, 16 insertions, 28 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 0f00f0e9f257..a7bf77384464 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -504,11 +504,9 @@ extern struct mutex hci_cb_list_lock;
504/* ----- HCI interface to upper protocols ----- */ 504/* ----- HCI interface to upper protocols ----- */
505int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 505int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
506int l2cap_disconn_ind(struct hci_conn *hcon); 506int l2cap_disconn_ind(struct hci_conn *hcon);
507void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason);
508int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags); 507int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
509 508
510int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); 509int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
511void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
512int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); 510int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
513 511
514/* ----- Inquiry cache ----- */ 512/* ----- Inquiry cache ----- */
@@ -1056,32 +1054,6 @@ static inline int hci_proto_disconn_ind(struct hci_conn *conn)
1056 return l2cap_disconn_ind(conn); 1054 return l2cap_disconn_ind(conn);
1057} 1055}
1058 1056
1059static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
1060{
1061 switch (conn->type) {
1062 case ACL_LINK:
1063 case LE_LINK:
1064 l2cap_disconn_cfm(conn, reason);
1065 break;
1066
1067 case SCO_LINK:
1068 case ESCO_LINK:
1069 sco_disconn_cfm(conn, reason);
1070 break;
1071
1072 /* L2CAP would be handled for BREDR chan */
1073 case AMP_LINK:
1074 break;
1075
1076 default:
1077 BT_ERR("unknown link type %d", conn->type);
1078 break;
1079 }
1080
1081 if (conn->disconn_cfm_cb)
1082 conn->disconn_cfm_cb(conn, reason);
1083}
1084
1085/* ----- HCI callbacks ----- */ 1057/* ----- HCI callbacks ----- */
1086struct hci_cb { 1058struct hci_cb {
1087 struct list_head list; 1059 struct list_head list;
@@ -1089,6 +1061,7 @@ struct hci_cb {
1089 char *name; 1061 char *name;
1090 1062
1091 void (*connect_cfm) (struct hci_conn *conn, __u8 status); 1063 void (*connect_cfm) (struct hci_conn *conn, __u8 status);
1064 void (*disconn_cfm) (struct hci_conn *conn, __u8 status);
1092 void (*security_cfm) (struct hci_conn *conn, __u8 status, 1065 void (*security_cfm) (struct hci_conn *conn, __u8 status,
1093 __u8 encrypt); 1066 __u8 encrypt);
1094 void (*key_change_cfm) (struct hci_conn *conn, __u8 status); 1067 void (*key_change_cfm) (struct hci_conn *conn, __u8 status);
@@ -1110,6 +1083,21 @@ static inline void hci_connect_cfm(struct hci_conn *conn, __u8 status)
1110 conn->connect_cfm_cb(conn, status); 1083 conn->connect_cfm_cb(conn, status);
1111} 1084}
1112 1085
1086static inline void hci_disconn_cfm(struct hci_conn *conn, __u8 reason)
1087{
1088 struct hci_cb *cb;
1089
1090 mutex_lock(&hci_cb_list_lock);
1091 list_for_each_entry(cb, &hci_cb_list, list) {
1092 if (cb->disconn_cfm)
1093 cb->disconn_cfm(conn, reason);
1094 }
1095 mutex_unlock(&hci_cb_list_lock);
1096
1097 if (conn->disconn_cfm_cb)
1098 conn->disconn_cfm_cb(conn, reason);
1099}
1100
1113static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) 1101static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
1114{ 1102{
1115 struct hci_cb *cb; 1103 struct hci_cb *cb;