From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCHv2 1/5] Bluetooth: clean up sco code
Date: Wed, 1 Dec 2010 19:20:34 -0200 [thread overview]
Message-ID: <20101201212034.GE16125@vigoh> (raw)
In-Reply-To: <1291215506-11398-2-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2010-12-01 16:58:22 +0200]:
> From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
>
> Do not use assignments in IF condition, remove extra spaces
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> ---
> include/net/bluetooth/sco.h | 8 ++++----
> net/bluetooth/sco.c | 22 +++++++++++++---------
> 2 files changed, 17 insertions(+), 13 deletions(-)
>
> diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
> index e28a2a7..ea5c664 100644
> --- a/include/net/bluetooth/sco.h
> +++ b/include/net/bluetooth/sco.h
> @@ -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;
> };
> diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
> index 66b9e5c..960c6d1 100644
> --- a/net/bluetooth/sco.c
> +++ b/net/bluetooth/sco.c
> @@ -44,7 +44,7 @@
> #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>
> @@ -52,7 +52,7 @@
>
> #define VERSION "0.6"
>
> -static int disable_esco = 0;
> +static int disable_esco;
I don't think this change is right. Can we be sure that disable_esco
will be 0 by default?
>
> static const struct proto_ops sco_sock_ops;
>
> @@ -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);
> @@ -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);
> @@ -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,
> @@ -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;
Otherwise looks good.
--
Gustavo F. Padovan
http://profusion.mobi
next prev parent reply other threads:[~2010-12-01 21:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-01 14:58 [PATCHv2 0/5] Clean up sco, rfcomm and hci code Emeltchenko Andrei
2010-12-01 14:58 ` [PATCHv2 1/5] Bluetooth: clean up sco code Emeltchenko Andrei
2010-12-01 21:20 ` Gustavo F. Padovan [this message]
2010-12-01 21:31 ` Anderson Lizardo
2010-12-01 21:44 ` Gustavo F. Padovan
2010-12-02 7:14 ` Johan Hedberg
2010-12-02 7:12 ` Johan Hedberg
2010-12-02 7:49 ` Marcel Holtmann
2010-12-01 14:58 ` [PATCHv2 2/5] Bluetooth: clean up rfcomm code Emeltchenko Andrei
2010-12-01 21:52 ` Gustavo F. Padovan
2010-12-01 14:58 ` [PATCHv2 3/5] Bluetooth: clean up l2cap code Emeltchenko Andrei
2010-12-01 21:21 ` Gustavo F. Padovan
2010-12-01 21:53 ` Gustavo F. Padovan
2010-12-01 14:58 ` [PATCHv2 4/5] Bluetooth: clean up hci code Emeltchenko Andrei
2010-12-01 21:53 ` Gustavo F. Padovan
2010-12-01 14:58 ` [PATCHv2 5/5] Bluetooth: clean up legal text Emeltchenko Andrei
2010-12-01 21:42 ` Gustavo F. Padovan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101201212034.GE16125@vigoh \
--to=padovan@profusion.mobi \
--cc=Andrei.Emeltchenko.news@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).