Commit 0f852724 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

Bluetooth: Rename __l2cap_chan_close() to l2cap_chan_close()

To make it consistent with the rest of the API.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 500698d3
...@@ -464,7 +464,7 @@ struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, ...@@ -464,7 +464,7 @@ struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
int proto, gfp_t prio); int proto, gfp_t prio);
struct l2cap_chan *l2cap_chan_create(struct sock *sk); struct l2cap_chan *l2cap_chan_create(struct sock *sk);
void __l2cap_chan_close(struct l2cap_chan *chan, int reason); void l2cap_chan_close(struct l2cap_chan *chan, int reason);
void l2cap_chan_destroy(struct l2cap_chan *chan); void l2cap_chan_destroy(struct l2cap_chan *chan);
int l2cap_chan_connect(struct l2cap_chan *chan); int l2cap_chan_connect(struct l2cap_chan *chan);
int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len); int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
......
...@@ -250,7 +250,7 @@ static void l2cap_chan_timeout(unsigned long arg) ...@@ -250,7 +250,7 @@ static void l2cap_chan_timeout(unsigned long arg)
else else
reason = ETIMEDOUT; reason = ETIMEDOUT;
__l2cap_chan_close(chan, reason); l2cap_chan_close(chan, reason);
bh_unlock_sock(sk); bh_unlock_sock(sk);
...@@ -383,16 +383,6 @@ static void l2cap_chan_del(struct l2cap_chan *chan, int err) ...@@ -383,16 +383,6 @@ static void l2cap_chan_del(struct l2cap_chan *chan, int err)
} }
} }
/* Must be called on unlocked socket. */
static void l2cap_chan_close(struct sock *sk)
{
l2cap_chan_clear_timer(l2cap_pi(sk)->chan);
lock_sock(sk);
__l2cap_chan_close(l2cap_pi(sk)->chan, ECONNRESET);
release_sock(sk);
l2cap_sock_kill(sk);
}
static void l2cap_chan_cleanup_listen(struct sock *parent) static void l2cap_chan_cleanup_listen(struct sock *parent)
{ {
struct sock *sk; struct sock *sk;
...@@ -400,14 +390,19 @@ static void l2cap_chan_cleanup_listen(struct sock *parent) ...@@ -400,14 +390,19 @@ static void l2cap_chan_cleanup_listen(struct sock *parent)
BT_DBG("parent %p", parent); BT_DBG("parent %p", parent);
/* Close not yet accepted channels */ /* Close not yet accepted channels */
while ((sk = bt_accept_dequeue(parent, NULL))) while ((sk = bt_accept_dequeue(parent, NULL))) {
l2cap_chan_close(sk); l2cap_chan_clear_timer(l2cap_pi(sk)->chan);
lock_sock(sk);
l2cap_chan_close(l2cap_pi(sk)->chan, ECONNRESET);
release_sock(sk);
l2cap_sock_kill(sk);
}
parent->sk_state = BT_CLOSED; parent->sk_state = BT_CLOSED;
sock_set_flag(parent, SOCK_ZAPPED); sock_set_flag(parent, SOCK_ZAPPED);
} }
void __l2cap_chan_close(struct l2cap_chan *chan, int reason) void l2cap_chan_close(struct l2cap_chan *chan, int reason)
{ {
struct l2cap_conn *conn = chan->conn; struct l2cap_conn *conn = chan->conn;
struct sock *sk = chan->sk; struct sock *sk = chan->sk;
...@@ -724,10 +719,10 @@ static void l2cap_conn_start(struct l2cap_conn *conn) ...@@ -724,10 +719,10 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
conn->feat_mask) conn->feat_mask)
&& chan->conf_state & && chan->conf_state &
L2CAP_CONF_STATE2_DEVICE) { L2CAP_CONF_STATE2_DEVICE) {
/* __l2cap_chan_close() calls list_del(chan) /* l2cap_chan_close() calls list_del(chan)
* so release the lock */ * so release the lock */
read_unlock_bh(&conn->chan_lock); read_unlock_bh(&conn->chan_lock);
__l2cap_chan_close(chan, ECONNRESET); l2cap_chan_close(chan, ECONNRESET);
read_lock_bh(&conn->chan_lock); read_lock_bh(&conn->chan_lock);
bh_unlock_sock(sk); bh_unlock_sock(sk);
continue; continue;
...@@ -4151,7 +4146,7 @@ static inline void l2cap_check_encryption(struct l2cap_chan *chan, u8 encrypt) ...@@ -4151,7 +4146,7 @@ static inline void l2cap_check_encryption(struct l2cap_chan *chan, u8 encrypt)
l2cap_chan_clear_timer(chan); l2cap_chan_clear_timer(chan);
l2cap_chan_set_timer(chan, HZ * 5); l2cap_chan_set_timer(chan, HZ * 5);
} else if (chan->sec_level == BT_SECURITY_HIGH) } else if (chan->sec_level == BT_SECURITY_HIGH)
__l2cap_chan_close(chan, ECONNREFUSED); l2cap_chan_close(chan, ECONNREFUSED);
} else { } else {
if (chan->sec_level == BT_SECURITY_MEDIUM) if (chan->sec_level == BT_SECURITY_MEDIUM)
l2cap_chan_clear_timer(chan); l2cap_chan_clear_timer(chan);
......
...@@ -707,7 +707,7 @@ static int l2cap_sock_shutdown(struct socket *sock, int how) ...@@ -707,7 +707,7 @@ static int l2cap_sock_shutdown(struct socket *sock, int how)
err = __l2cap_wait_ack(sk); err = __l2cap_wait_ack(sk);
sk->sk_shutdown = SHUTDOWN_MASK; sk->sk_shutdown = SHUTDOWN_MASK;
__l2cap_chan_close(chan, 0); l2cap_chan_close(chan, 0);
if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime)
err = bt_sock_wait_state(sk, BT_CLOSED, err = bt_sock_wait_state(sk, BT_CLOSED,
......
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