summaryrefslogtreecommitdiff
path: root/net/bluetooth/sco.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-07-14 03:30:15 +0400
committerJohan Hedberg <johan.hedberg@intel.com>2014-07-14 14:10:57 +0400
commiteb5a4de80f266d0bb7edd43c61894da74faaa91a (patch)
treec355496be9622f0601e192ba156f7f7f6c588a1e /net/bluetooth/sco.c
parent5a54e7c85b8303b84a9b2fbf978a74d625f85a99 (diff)
downloadlinux-eb5a4de80f266d0bb7edd43c61894da74faaa91a.tar.xz
Bluetooth: Remove sco_chan_get helper function
The sco_chan_get helper function is only used in two places and really only protects conn->sk with a lock. So instead of hiding that fact, just put the actual code in place where it is used. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/sco.c')
-rw-r--r--net/bluetooth/sco.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 4d67b0354d23..ebf7ee6a446c 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -127,15 +127,6 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon)
return conn;
}
-static struct sock *sco_chan_get(struct sco_conn *conn)
-{
- struct sock *sk = NULL;
- sco_conn_lock(conn);
- sk = conn->sk;
- sco_conn_unlock(conn);
- return sk;
-}
-
/* Delete channel.
* Must be called on the locked socket. */
static void sco_chan_del(struct sock *sk, int err)
@@ -174,7 +165,10 @@ static int sco_conn_del(struct hci_conn *hcon, int err)
BT_DBG("hcon %p conn %p, err %d", hcon, conn, err);
/* Kill socket */
- sk = sco_chan_get(conn);
+ sco_conn_lock(conn);
+ sk = conn->sk;
+ sco_conn_unlock(conn);
+
if (sk) {
bh_lock_sock(sk);
sco_sock_clear_timer(sk);
@@ -303,7 +297,11 @@ static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
static void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb)
{
- struct sock *sk = sco_chan_get(conn);
+ struct sock *sk;
+
+ sco_conn_lock(conn);
+ sk = conn->sk;
+ sco_conn_unlock(conn);
if (!sk)
goto drop;