Skip to content

Commit

Permalink
Bluetooth: clean up sco code
Browse files Browse the repository at this point in the history
Do not use assignments in IF condition, remove extra spaces

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Andrei Emeltchenko authored and Gustavo F. Padovan committed Dec 1, 2010
1 parent b78d7b4 commit 735cbc4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
8 changes: 4 additions & 4 deletions include/net/bluetooth/sco.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ struct sco_conninfo {
struct sco_conn {
struct hci_conn *hcon;

bdaddr_t *dst;
bdaddr_t *src;
bdaddr_t *dst;
bdaddr_t *src;

spinlock_t lock;
struct sock *sk;
struct sock *sk;

unsigned int mtu;
};
Expand Down
22 changes: 13 additions & 9 deletions net/bluetooth/sco.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
#include <net/sock.h>

#include <asm/system.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>

#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
#include <net/bluetooth/sco.h>

#define VERSION "0.6"

static int disable_esco = 0;
static int disable_esco;

static const struct proto_ops sco_sock_ops;

Expand Down Expand Up @@ -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)
{
struct sco_conn *conn;
struct sco_conn *conn = hcon->sco_data;
struct sock *sk;

if (!(conn = hcon->sco_data))
if (!conn)
return 0;

BT_DBG("hcon %p conn %p, err %d", hcon, conn, err);

/* Kill socket */
if ((sk = sco_chan_get(conn))) {
sk = sco_chan_get(conn);
if (sk) {
bh_lock_sock(sk);
sco_sock_clear_timer(sk);
sco_chan_del(sk, err);
Expand Down Expand Up @@ -185,7 +186,8 @@ static int sco_connect(struct sock *sk)

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;

hci_dev_lock_bh(hdev);
Expand Down Expand Up @@ -510,7 +512,8 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
/* Set destination address and psm */
bacpy(&bt_sk(sk)->dst, &sa->sco_bdaddr);

if ((err = sco_connect(sk)))
err = sco_connect(sk);
if (err)
goto done;

err = bt_sock_wait_state(sk, BT_CONNECTED,
Expand Down Expand Up @@ -828,13 +831,14 @@ static void sco_chan_del(struct sock *sk, int err)

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);

sco_conn_lock(conn);

if ((sk = conn->sk)) {
if (sk) {
sco_sock_clear_timer(sk);
bh_lock_sock(sk);
sk->sk_state = BT_CONNECTED;
Expand Down

0 comments on commit 735cbc4

Please sign in to comment.