* [PATCH 1/3] Bluetooth: Rename hci_acl_disconn to hci_disconnect
@ 2011-06-08 22:10 Gustavo F. Padovan
2011-06-08 22:10 ` [PATCH 2/3] Bluetooth: Merge similar code in l2cap_conn_ready() Gustavo F. Padovan
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo F. Padovan @ 2011-06-08 22:10 UTC (permalink / raw)
To: linux-bluetooth
hci_disconnect() takes care of both ACL and LE connections
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
include/net/bluetooth/hci_core.h | 2 +-
net/bluetooth/hci_conn.c | 4 ++--
net/bluetooth/hci_core.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 818eadb..7be2280 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -421,7 +421,6 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
}
void hci_acl_connect(struct hci_conn *conn);
-void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
void hci_add_sco(struct hci_conn *conn, __u16 handle);
void hci_setup_sync(struct hci_conn *conn, __u16 handle);
void hci_sco_setup(struct hci_conn *conn, __u8 status);
@@ -432,6 +431,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev);
void hci_conn_check_pending(struct hci_dev *hdev);
struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type);
+void hci_disconnect(struct hci_conn *conn, __u8 reason);
int hci_conn_check_link_mode(struct hci_conn *conn);
int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level);
int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type);
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 37f5a17..351c860 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -129,7 +129,7 @@ static void hci_acl_connect_cancel(struct hci_conn *conn)
hci_send_cmd(conn->hdev, HCI_OP_CREATE_CONN_CANCEL, sizeof(cp), &cp);
}
-void hci_acl_disconn(struct hci_conn *conn, __u8 reason)
+void hci_disconnect(struct hci_conn *conn, __u8 reason)
{
struct hci_cp_disconnect cp;
@@ -251,7 +251,7 @@ static void hci_conn_timeout(unsigned long arg)
case BT_CONFIG:
case BT_CONNECTED:
reason = hci_proto_disconn_ind(conn);
- hci_acl_disconn(conn, reason);
+ hci_disconnect(conn, reason);
break;
default:
conn->state = BT_CLOSED;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e14e8a1..1076f46 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1945,7 +1945,7 @@ static inline void hci_link_tx_to(struct hci_dev *hdev, __u8 type)
if (c->type == type && c->sent) {
BT_ERR("%s killing stalled connection %s",
hdev->name, batostr(&c->dst));
- hci_acl_disconn(c, 0x13);
+ hci_disconnect(c, 0x13);
}
}
}
--
1.7.5.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] Bluetooth: Merge similar code in l2cap_conn_ready()
2011-06-08 22:10 [PATCH 1/3] Bluetooth: Rename hci_acl_disconn to hci_disconnect Gustavo F. Padovan
@ 2011-06-08 22:10 ` Gustavo F. Padovan
2011-06-08 22:10 ` [PATCH 3/3] Bluetooth: Don't forget to check for LE_LINK Gustavo F. Padovan
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo F. Padovan @ 2011-06-08 22:10 UTC (permalink / raw)
To: linux-bluetooth
In both conditions we do exacly the same thing, so merge them.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
net/bluetooth/l2cap_core.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 3af8882..28d4cf7 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -905,13 +905,8 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
bh_lock_sock(sk);
- if (conn->hcon->type == LE_LINK) {
- __clear_chan_timer(chan);
- l2cap_state_change(chan, BT_CONNECTED);
- sk->sk_state_change(sk);
- }
-
- if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
+ if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED ||
+ conn->hcon->type == LE_LINK) {
__clear_chan_timer(chan);
l2cap_state_change(chan, BT_CONNECTED);
sk->sk_state_change(sk);
--
1.7.5.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] Bluetooth: Don't forget to check for LE_LINK
2011-06-08 22:10 ` [PATCH 2/3] Bluetooth: Merge similar code in l2cap_conn_ready() Gustavo F. Padovan
@ 2011-06-08 22:10 ` Gustavo F. Padovan
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo F. Padovan @ 2011-06-08 22:10 UTC (permalink / raw)
To: linux-bluetooth
Otherwise the wrong error can be returned.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
net/bluetooth/l2cap_core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 28d4cf7..a31dc0d 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4122,7 +4122,7 @@ static int l2cap_disconn_ind(struct hci_conn *hcon)
BT_DBG("hcon %p", hcon);
- if (hcon->type != ACL_LINK || !conn)
+ if ((hcon->type != ACL_LINK && hcon->type != LE_LINK) || !conn)
return 0x13;
return conn->disc_reason;
--
1.7.5.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-08 22:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 22:10 [PATCH 1/3] Bluetooth: Rename hci_acl_disconn to hci_disconnect Gustavo F. Padovan
2011-06-08 22:10 ` [PATCH 2/3] Bluetooth: Merge similar code in l2cap_conn_ready() Gustavo F. Padovan
2011-06-08 22:10 ` [PATCH 3/3] Bluetooth: Don't forget to check for LE_LINK Gustavo F. Padovan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox