Bluetooth: Introduce L2CAP channel callback for resuming
Clearing the BT_SK_SUSPEND socket flag from the L2CAP core is causing a dependency on the socket. So intead of doing that, use a channel callback into the socket handling to resume. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
committed by
Johan Hedberg
parent
bdc2578307
commit
d97c899bde
@@ -554,6 +554,7 @@ struct l2cap_ops {
|
|||||||
int state);
|
int state);
|
||||||
void (*ready) (struct l2cap_chan *chan);
|
void (*ready) (struct l2cap_chan *chan);
|
||||||
void (*defer) (struct l2cap_chan *chan);
|
void (*defer) (struct l2cap_chan *chan);
|
||||||
|
void (*resume) (struct l2cap_chan *chan);
|
||||||
struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
|
struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
|
||||||
unsigned long len, int nb);
|
unsigned long len, int nb);
|
||||||
};
|
};
|
||||||
|
@@ -6669,11 +6669,7 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
|
|||||||
|
|
||||||
if (!status && (chan->state == BT_CONNECTED ||
|
if (!status && (chan->state == BT_CONNECTED ||
|
||||||
chan->state == BT_CONFIG)) {
|
chan->state == BT_CONFIG)) {
|
||||||
struct sock *sk = chan->sk;
|
chan->ops->resume(chan);
|
||||||
|
|
||||||
clear_bit(BT_SK_SUSPEND, &bt_sk(sk)->flags);
|
|
||||||
sk->sk_state_change(sk);
|
|
||||||
|
|
||||||
l2cap_check_encryption(chan, encrypt);
|
l2cap_check_encryption(chan, encrypt);
|
||||||
l2cap_chan_unlock(chan);
|
l2cap_chan_unlock(chan);
|
||||||
continue;
|
continue;
|
||||||
|
@@ -1112,6 +1112,14 @@ static void l2cap_sock_defer_cb(struct l2cap_chan *chan)
|
|||||||
parent->sk_data_ready(parent, 0);
|
parent->sk_data_ready(parent, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void l2cap_sock_resume_cb(struct l2cap_chan *chan)
|
||||||
|
{
|
||||||
|
struct sock *sk = chan->data;
|
||||||
|
|
||||||
|
clear_bit(BT_SK_SUSPEND, &bt_sk(sk)->flags);
|
||||||
|
sk->sk_state_change(sk);
|
||||||
|
}
|
||||||
|
|
||||||
static struct l2cap_ops l2cap_chan_ops = {
|
static struct l2cap_ops l2cap_chan_ops = {
|
||||||
.name = "L2CAP Socket Interface",
|
.name = "L2CAP Socket Interface",
|
||||||
.new_connection = l2cap_sock_new_connection_cb,
|
.new_connection = l2cap_sock_new_connection_cb,
|
||||||
@@ -1121,6 +1129,7 @@ static struct l2cap_ops l2cap_chan_ops = {
|
|||||||
.state_change = l2cap_sock_state_change_cb,
|
.state_change = l2cap_sock_state_change_cb,
|
||||||
.ready = l2cap_sock_ready_cb,
|
.ready = l2cap_sock_ready_cb,
|
||||||
.defer = l2cap_sock_defer_cb,
|
.defer = l2cap_sock_defer_cb,
|
||||||
|
.resume = l2cap_sock_resume_cb,
|
||||||
.alloc_skb = l2cap_sock_alloc_skb_cb,
|
.alloc_skb = l2cap_sock_alloc_skb_cb,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user