linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH_v2 3/6] bnep: Add bnep_new and bnep_free api's
Date: Tue, 17 Dec 2013 11:42:48 +0200	[thread overview]
Message-ID: <52B01C98.2050905@linux.intel.com> (raw)
In-Reply-To: <CABBYNZKMECuAd2WBQ8-FE5OO9Qtp0g=iKTBA3zV8JOa6cxAN9w@mail.gmail.com>

Hi Luiz,

On 17.12.2013 11:19, Luiz Augusto von Dentz wrote:
> Hi Ravi,
>
> On Tue, Dec 17, 2013 at 12:05 AM, Ravi kumar Veeramally
> <ravikumar.veeramally@linux.intel.com> wrote:
>> Refacoring connect and disconnect mechanisms. It would be more
>> convinient for caller to maintain just bnep connection reference
>> and delete whenever it is not required.
>> ---
>>   profiles/network/bnep.c | 37 +++++++++++++++++++++++++++++++++++++
>>   profiles/network/bnep.h |  5 +++++
>>   2 files changed, 42 insertions(+)
>>
>> diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
>> index 08037e6..d7d8832 100644
>> --- a/profiles/network/bnep.c
>> +++ b/profiles/network/bnep.c
>> @@ -71,6 +71,7 @@ struct bnep_conn {
>>          GIOChannel      *io;
>>          uint16_t        src;
>>          uint16_t        dst;
>> +       bdaddr_t        dst_addr;
>>          guint   attempts;
>>          guint   setup_to;
>>          void    *data;
>> @@ -246,6 +247,42 @@ int bnep_if_down(const char *devname)
>>          return 0;
>>   }
>>
>> +struct bnep_conn *bnep_new(uint16_t src, uint16_t dst,
>> +                                               const bdaddr_t *dst_addr)
> I would change the order of the parameters, also do not use bdaddr_t
> otherwise you wont be able to do unit tests with it, something like
> bnep_new(int fd, uint16_t local_role, uint16_t remote_role) looks
> better, but perhaps you gonna need the MTU as well.
   bdaddr_t is required incase if it unable to up the interface, connection
  needs to be deleted and it is difficult to track on which error we have to
  delete the connection. And one more thing I am moving many of these
  apis to local to the bnep.c.
  Regarding MTU at least now it is not required by connection.c or 
android/pan.c.
>> +{
>> +       struct bnep_conn *bc;
>> +
>> +       DBG("");
>> +
>> +       if (!dst_addr)
>> +               return NULL;
>> +
>> +       bc = g_new0(struct bnep_conn, 1);
>> +       if (!bc)
>> +               return NULL;
> No need to check the return of g_new0, if it fails it will exit so
> this code will never be triggered.
Ok.

Thanks,
Ravi.

  reply	other threads:[~2013-12-17  9:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 22:05 [PATCH_v2 1/6] android/pan: Rename pan_device_free to destroy_pan_device Ravi kumar Veeramally
2013-12-16 22:05 ` [PATCH_v2 2/6] android/pan: Rename connect_cb to bt_io_connect_cb Ravi kumar Veeramally
2013-12-17  9:27   ` Johan Hedberg
2013-12-17  9:38     ` Ravi kumar Veeramally
2013-12-16 22:05 ` [PATCH_v2 3/6] bnep: Add bnep_new and bnep_free api's Ravi kumar Veeramally
2013-12-17  9:19   ` Luiz Augusto von Dentz
2013-12-17  9:42     ` Ravi kumar Veeramally [this message]
2013-12-16 22:05 ` [PATCH_v2 4/6] bnep: Refactored bnep connect and disconnect calls Ravi kumar Veeramally
2013-12-16 22:05 ` [PATCH_v2 5/6] bnep: Refactored bnep server apis for bridge addition and deletion Ravi kumar Veeramally
2013-12-16 22:05 ` [PATCH_v2 6/6] bnep: Refactor bnep setup response validation functionality Ravi kumar Veeramally
2013-12-17  9:09 ` [PATCH_v2 1/6] android/pan: Rename pan_device_free to destroy_pan_device Luiz Augusto von Dentz

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=52B01C98.2050905@linux.intel.com \
    --to=ravikumar.veeramally@linux.intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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).