提交 735cbc47 编写于 作者: A Andrei Emeltchenko 提交者: Gustavo F. Padovan

Bluetooth: clean up sco code

Do not use assignments in IF condition, remove extra spaces
Signed-off-by: NAndrei Emeltchenko <andrei.emeltchenko@nokia.com>
Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
上级 b78d7b4f
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include <net/sock.h> #include <net/sock.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#include <net/bluetooth/bluetooth.h> #include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h> #include <net/bluetooth/hci_core.h>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#define VERSION "0.6" #define VERSION "0.6"
static int disable_esco = 0; static int disable_esco;
static const struct proto_ops sco_sock_ops; static const struct proto_ops sco_sock_ops;
...@@ -138,16 +138,17 @@ static inline struct sock *sco_chan_get(struct sco_conn *conn) ...@@ -138,16 +138,17 @@ static inline struct sock *sco_chan_get(struct sco_conn *conn)
static int sco_conn_del(struct hci_conn *hcon, int err) static int sco_conn_del(struct hci_conn *hcon, int err)
{ {
struct sco_conn *conn; struct sco_conn *conn = hcon->sco_data;
struct sock *sk; struct sock *sk;
if (!(conn = hcon->sco_data)) if (!conn)
return 0; return 0;
BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); BT_DBG("hcon %p conn %p, err %d", hcon, conn, err);
/* Kill socket */ /* Kill socket */
if ((sk = sco_chan_get(conn))) { sk = sco_chan_get(conn);
if (sk) {
bh_lock_sock(sk); bh_lock_sock(sk);
sco_sock_clear_timer(sk); sco_sock_clear_timer(sk);
sco_chan_del(sk, err); sco_chan_del(sk, err);
...@@ -185,7 +186,8 @@ static int sco_connect(struct sock *sk) ...@@ -185,7 +186,8 @@ static int sco_connect(struct sock *sk)
BT_DBG("%s -> %s", batostr(src), batostr(dst)); BT_DBG("%s -> %s", batostr(src), batostr(dst));
if (!(hdev = hci_get_route(dst, src))) hdev = hci_get_route(dst, src);
if (!hdev)
return -EHOSTUNREACH; return -EHOSTUNREACH;
hci_dev_lock_bh(hdev); hci_dev_lock_bh(hdev);
...@@ -510,7 +512,8 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen ...@@ -510,7 +512,8 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
/* Set destination address and psm */ /* Set destination address and psm */
bacpy(&bt_sk(sk)->dst, &sa->sco_bdaddr); bacpy(&bt_sk(sk)->dst, &sa->sco_bdaddr);
if ((err = sco_connect(sk))) err = sco_connect(sk);
if (err)
goto done; goto done;
err = bt_sock_wait_state(sk, BT_CONNECTED, err = bt_sock_wait_state(sk, BT_CONNECTED,
...@@ -828,13 +831,14 @@ static void sco_chan_del(struct sock *sk, int err) ...@@ -828,13 +831,14 @@ static void sco_chan_del(struct sock *sk, int err)
static void sco_conn_ready(struct sco_conn *conn) static void sco_conn_ready(struct sco_conn *conn)
{ {
struct sock *parent, *sk; struct sock *parent;
struct sock *sk = conn->sk;
BT_DBG("conn %p", conn); BT_DBG("conn %p", conn);
sco_conn_lock(conn); sco_conn_lock(conn);
if ((sk = conn->sk)) { if (sk) {
sco_sock_clear_timer(sk); sco_sock_clear_timer(sk);
bh_lock_sock(sk); bh_lock_sock(sk);
sk->sk_state = BT_CONNECTED; sk->sk_state = BT_CONNECTED;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册