From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Gustavo Padovan <gustavo@padovan.org>
Cc: linux-bluetooth@vger.kernel.org,
Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Subject: Re: [PATCH -v2] Bluetooth: Create function to return the ERTM header size
Date: Tue, 29 May 2012 09:58:32 +0300 [thread overview]
Message-ID: <20120529065828.GA15895@aemeltch-MOBL1> (raw)
In-Reply-To: <1338260317-13308-1-git-send-email-gustavo@padovan.org>
Hi Gustavo,
On Mon, May 28, 2012 at 11:58:37PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Simplify the handling of different ERTM header size. We were the same
> check in some places of the code, and more is expected to come, so just
> replace them with a function.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> net/bluetooth/l2cap_core.c | 25 +++++++++++--------------
> 1 file changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 6f30d1d..ad06393 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -814,17 +814,20 @@ static inline void __pack_control(struct l2cap_chan *chan,
> }
> }
>
> +static inline unsigned int l2cap_ertm_hdr_size(struct l2cap_chan *chan)
> +{
> + if (test_bit(FLAG_EXT_CTRL, &chan->flags))
> + return L2CAP_EXT_HDR_SIZE;
> + else
> + return L2CAP_ENH_HDR_SIZE;
> +}
> +
> static struct sk_buff *l2cap_create_sframe_pdu(struct l2cap_chan *chan,
> u32 control)
> {
> struct sk_buff *skb;
> struct l2cap_hdr *lh;
> - int hlen;
> -
> - if (test_bit(FLAG_EXT_CTRL, &chan->flags))
> - hlen = L2CAP_EXT_HDR_SIZE;
> - else
> - hlen = L2CAP_ENH_HDR_SIZE;
> + int hlen = l2cap_ertm_hdr_size(chan);
I prefer simpler name like:
int hlen = __hdr_size(chan); or __ertm_hdr_size
Otherwise looks good.
Best regards
Andrei Emeltchenko
next prev parent reply other threads:[~2012-05-29 6:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-29 2:55 [PATCH 1/2] Bluetooth: Create function to to the ERTM header size Gustavo Padovan
2012-05-29 2:55 ` [PATCH 2/2] Bluetooth: Remove unused err var from l2cap_segment_sdu() Gustavo Padovan
2012-05-29 2:58 ` [PATCH -v2] Bluetooth: Create function to return the ERTM header size Gustavo Padovan
2012-05-29 6:58 ` Andrei Emeltchenko [this message]
2012-05-29 15:27 ` Gustavo 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=20120529065828.GA15895@aemeltch-MOBL1 \
--to=andrei.emeltchenko.news@gmail.com \
--cc=gustavo.padovan@collabora.co.uk \
--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