Linux bluetooth development
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFCv1 4/6] Bluetooth: Handle number of compl blocks for AMP_LINK
Date: Wed, 10 Oct 2012 11:22:27 +0300	[thread overview]
Message-ID: <20121010082225.GA7620@aemeltch-MOBL1> (raw)
In-Reply-To: <1349794158.27233.94.camel@aeonflux>

Hi Marcel,

On Tue, Oct 09, 2012 at 04:49:18PM +0200, Marcel Holtmann wrote:
> Hi Andrei,
> 
> > Add handling blocks count for AMP link.
> > 
> > Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> > ---
> >  net/bluetooth/hci_event.c |   12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> > index 82e478a..c479732 100644
> > --- a/net/bluetooth/hci_event.c
> > +++ b/net/bluetooth/hci_event.c
> > @@ -2698,13 +2698,21 @@ static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb)
> >  
> >  	for (i = 0; i < ev->num_hndl; i++) {
> >  		struct hci_comp_blocks_info *info = &ev->handles[i];
> > -		struct hci_conn *conn;
> > +		struct hci_conn *conn = NULL;
> > +		struct hci_chan *chan;
> >  		__u16  handle, block_count;
> >  
> >  		handle = __le16_to_cpu(info->handle);
> >  		block_count = __le16_to_cpu(info->blocks);
> >  
> > -		conn = hci_conn_hash_lookup_handle(hdev, handle);
> > +		if (hdev->dev_type == HCI_BREDR) {
> > +			conn = hci_conn_hash_lookup_handle(hdev, handle);
> > +		} else {
> > +			chan = hci_chan_lookup_handle_all(hdev, handle);
> > +			if (chan)
> > +				conn = chan->conn;
> 
> Just in case, we better use a switch statement here.
> 
> And now coming to think about it, do we ever need the hci_chan anyway.

For AMP hchan represents logical link so it is needed.

> Then why not have a function that looks up the hci_conn.
> 
> Maybe introduce a new hci_conn_lookup_handle(hdev, handle) and it will
> do the right thing depending on what the device type is.

This looks good, will do this way.

Best regards 
Andrei Emeltchenko 

  reply	other threads:[~2012-10-10  8:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-08 14:52 [RFCv1 0/6] Handle AMP_LINK Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 1/6] Bluetooth: Allow to set flush timeout Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 2/6] Bluetooth: AMP: Handle AMP_LINK timeout Andrei Emeltchenko
2012-10-09 14:39   ` Marcel Holtmann
2012-10-08 14:52 ` [RFCv1 3/6] Bluetooth: AMP: Add handle to hci_chan structure Andrei Emeltchenko
2012-10-09 14:46   ` Marcel Holtmann
2012-10-10  8:34     ` Andrei Emeltchenko
2012-10-10 10:07       ` Marcel Holtmann
2012-10-10 10:12         ` Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 4/6] Bluetooth: Handle number of compl blocks for AMP_LINK Andrei Emeltchenko
2012-10-09 14:49   ` Marcel Holtmann
2012-10-10  8:22     ` Andrei Emeltchenko [this message]
2012-10-08 14:52 ` [RFCv1 5/6] Bluetooth: AMP: Handle AMP_LINK connection Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 6/6] Bluetooth: AMP: Hanlde AMP_LINK case in conn_put Andrei Emeltchenko
2012-10-10 14:38 ` [PATCHv1 0/6] Handle AMP_LINK Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 1/6] Bluetooth: Allow to set flush timeout Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 2/6] Bluetooth: AMP: Handle AMP_LINK timeout Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 3/6] Bluetooth: AMP: Add handle to hci_chan structure Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 4/6] Bluetooth: AMP: Handle number of compl blocks for AMP_LINK Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 5/6] Bluetooth: AMP: Handle AMP_LINK connection Andrei Emeltchenko
2012-10-10 14:38   ` [PATCHv1 6/6] Bluetooth: AMP: Hanlde AMP_LINK case in conn_put Andrei Emeltchenko
2012-10-11  6:36     ` Gustavo Padovan
2012-10-10 15:28   ` [PATCHv1 0/6] Handle AMP_LINK Marcel Holtmann

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=20121010082225.GA7620@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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