diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-07-13 19:30:15 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-07-14 06:10:57 -0400 |
commit | eb5a4de80f266d0bb7edd43c61894da74faaa91a (patch) | |
tree | c355496be9622f0601e192ba156f7f7f6c588a1e /net/bluetooth/sco.c | |
parent | 5a54e7c85b8303b84a9b2fbf978a74d625f85a99 (diff) |
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.c | 20 |
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) | |||
127 | return conn; | 127 | return conn; |
128 | } | 128 | } |
129 | 129 | ||
130 | static struct sock *sco_chan_get(struct sco_conn *conn) | ||
131 | { | ||
132 | struct sock *sk = NULL; | ||
133 | sco_conn_lock(conn); | ||
134 | sk = conn->sk; | ||
135 | sco_conn_unlock(conn); | ||
136 | return sk; | ||
137 | } | ||
138 | |||
139 | /* Delete channel. | 130 | /* Delete channel. |
140 | * Must be called on the locked socket. */ | 131 | * Must be called on the locked socket. */ |
141 | static void sco_chan_del(struct sock *sk, int err) | 132 | 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) | |||
174 | BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); | 165 | BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); |
175 | 166 | ||
176 | /* Kill socket */ | 167 | /* Kill socket */ |
177 | sk = sco_chan_get(conn); | 168 | sco_conn_lock(conn); |
169 | sk = conn->sk; | ||
170 | sco_conn_unlock(conn); | ||
171 | |||
178 | if (sk) { | 172 | if (sk) { |
179 | bh_lock_sock(sk); | 173 | bh_lock_sock(sk); |
180 | sco_sock_clear_timer(sk); | 174 | sco_sock_clear_timer(sk); |
@@ -303,7 +297,11 @@ static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len) | |||
303 | 297 | ||
304 | static void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb) | 298 | static void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb) |
305 | { | 299 | { |
306 | struct sock *sk = sco_chan_get(conn); | 300 | struct sock *sk; |
301 | |||
302 | sco_conn_lock(conn); | ||
303 | sk = conn->sk; | ||
304 | sco_conn_unlock(conn); | ||
307 | 305 | ||
308 | if (!sk) | 306 | if (!sk) |
309 | goto drop; | 307 | goto drop; |