linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
To: Gustavo Padovan <gustavo@padovan.org>,
	Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 4/5] Bluetooth: Simplify a the connection type handling
Date: Thu, 31 May 2012 14:27:22 -0300	[thread overview]
Message-ID: <20120531172722.GA7272@samus> (raw)
In-Reply-To: <20120531132205.GL18069@joana>

Hi,

On 10:22 Thu 31 May, Gustavo Padovan wrote:
> Hi Andrei,
> 
> * Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com> [2012-05-31 10:39:16 +0300]:
> 
> > Hi Vinicius,
> > 
> > On Wed, May 30, 2012 at 09:20:19PM -0300, Vinicius Costa Gomes wrote:
> > > Now that we have separate ways of doing connections for each link type,
> > > we can do better than an "if" statement to handle each link type.
> > > 
> > > Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> > > ---
> > >  net/bluetooth/hci_conn.c |   11 +++++++----
> > >  1 file changed, 7 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> > > index 320cc5d..8848a1e 100644
> > > --- a/net/bluetooth/hci_conn.c
> > > +++ b/net/bluetooth/hci_conn.c
> > > @@ -563,13 +563,16 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
> > >  {
> > >  	BT_DBG("%s dst %s", hdev->name, batostr(dst));
> > >  
> > > -	if (type == LE_LINK)
> > > +	switch (type) {
> > > +	case LE_LINK:
> > >  		return add_le_conn(hdev, dst, dst_type, sec_level, auth_type);
> > > -
> > > -	if (type == ACL_LINK)
> > > +	case ACL_LINK:
> > >  		return add_acl_conn(hdev, dst, sec_level, auth_type);
> > > +	case SCO_LINK:
> > > +		return add_sco_conn(hdev, dst, sec_level, auth_type);
> > 
> > The patches looks OK but somehow I do not like much returns in switch.
> > Some parsers will notice missing breaks which are not needed here...
> 
> Use return here seems ok to me, I just want that these functions gets a hci_
> prefix.

Fair enough. So I am going with hci_add_{acl,sco,le}.

> 
> 	Gustavo


Cheers,
-- 
Vinicius

  reply	other threads:[~2012-05-31 17:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31  0:20 [PATCH 1/5] Bluetooth: Refactor LE connection into its own function Vinicius Costa Gomes
2012-05-31  0:20 ` [PATCH 2/5] Bluetooth: Refactor ACL " Vinicius Costa Gomes
2012-05-31  0:20 ` [PATCH 3/5] Bluetooth: Refactor SCO " Vinicius Costa Gomes
2012-05-31  0:20 ` [PATCH 4/5] Bluetooth: Simplify a the connection type handling Vinicius Costa Gomes
2012-05-31  7:39   ` Andrei Emeltchenko
2012-05-31 13:22     ` Gustavo Padovan
2012-05-31 17:27       ` Vinicius Costa Gomes [this message]
2012-05-31  7:43   ` Andrei Emeltchenko
2012-05-31  0:20 ` [PATCH 5/5] Bluetooth: Add type information to the hci_connect() debug statement Vinicius Costa Gomes

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=20120531172722.GA7272@samus \
    --to=vinicius.gomes@openbossa.org \
    --cc=andrei.emeltchenko.news@gmail.com \
    --cc=gustavo@padovan.org \
    --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).