Commit 820ffdb3 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

Bluetooth: Remove struct del_list

As we use struct list_head to keep L2CAP channels list the workaround with
del_list is not needed anymore.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent baa7e1fa
...@@ -309,11 +309,6 @@ struct l2cap_conn { ...@@ -309,11 +309,6 @@ struct l2cap_conn {
rwlock_t chan_lock; rwlock_t chan_lock;
}; };
struct sock_del_list {
struct sock *sk;
struct list_head list;
};
#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04
#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08
......
...@@ -487,16 +487,13 @@ void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err) ...@@ -487,16 +487,13 @@ void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err)
/* ---- L2CAP connections ---- */ /* ---- L2CAP connections ---- */
static void l2cap_conn_start(struct l2cap_conn *conn) static void l2cap_conn_start(struct l2cap_conn *conn)
{ {
struct sock_del_list del, *tmp1, *tmp2; struct l2cap_chan *chan, *tmp;
struct l2cap_chan *chan;
BT_DBG("conn %p", conn); BT_DBG("conn %p", conn);
INIT_LIST_HEAD(&del.list);
read_lock(&conn->chan_lock); read_lock(&conn->chan_lock);
list_for_each_entry(chan, &conn->chan_l, list) { list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
struct sock *sk = chan->sk; struct sock *sk = chan->sk;
bh_lock_sock(sk); bh_lock_sock(sk);
...@@ -520,10 +517,11 @@ static void l2cap_conn_start(struct l2cap_conn *conn) ...@@ -520,10 +517,11 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
conn->feat_mask) conn->feat_mask)
&& l2cap_pi(sk)->conf_state & && l2cap_pi(sk)->conf_state &
L2CAP_CONF_STATE2_DEVICE) { L2CAP_CONF_STATE2_DEVICE) {
tmp1 = kzalloc(sizeof(struct sock_del_list), /* __l2cap_sock_close() calls list_del(chan)
GFP_ATOMIC); * so release the lock */
tmp1->sk = sk; read_unlock_bh(&conn->chan_lock);
list_add_tail(&tmp1->list, &del.list); __l2cap_sock_close(sk, ECONNRESET);
read_lock_bh(&conn->chan_lock);
bh_unlock_sock(sk); bh_unlock_sock(sk);
continue; continue;
} }
...@@ -579,14 +577,6 @@ static void l2cap_conn_start(struct l2cap_conn *conn) ...@@ -579,14 +577,6 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
} }
read_unlock(&conn->chan_lock); read_unlock(&conn->chan_lock);
list_for_each_entry_safe(tmp1, tmp2, &del.list, list) {
bh_lock_sock(tmp1->sk);
__l2cap_sock_close(tmp1->sk, ECONNRESET);
bh_unlock_sock(tmp1->sk);
list_del(&tmp1->list);
kfree(tmp1);
}
} }
/* Find socket with cid and source bdaddr. /* Find socket with cid and source bdaddr.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment