linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Remove unneeded calculation and magic number
@ 2012-05-03  7:55 Andrei Emeltchenko
  2012-05-03  8:18 ` Andrei Emeltchenko
  2012-05-04 19:23 ` Gustavo Padovan
  0 siblings, 2 replies; 6+ messages in thread
From: Andrei Emeltchenko @ 2012-05-03  7:55 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Remove magic number unneeded calculation since
hlen = L2CAP_HDR_SIZE + L2CAP_PSMLEN_SIZE

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/l2cap_core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 07a09cc..1748c3c 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1922,8 +1922,8 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
 	/* Create L2CAP header */
 	lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
 	lh->cid = cpu_to_le16(chan->dcid);
-	lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE));
-	put_unaligned(chan->psm, skb_put(skb, 2));
+	lh->len = cpu_to_le16(len + L2CAP_PSMLEN_SIZE);
+	put_unaligned(chan->psm, skb_put(skb, L2CAP_PSMLEN_SIZE));
 
 	err = l2cap_skbuff_fromiovec(chan, msg, len, count, skb);
 	if (unlikely(err < 0)) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: Remove unneeded calculation and magic number
  2012-05-03  7:55 Andrei Emeltchenko
@ 2012-05-03  8:18 ` Andrei Emeltchenko
  2012-05-03  8:28   ` Andrei Emeltchenko
  2012-05-04 19:23 ` Gustavo Padovan
  1 sibling, 1 reply; 6+ messages in thread
From: Andrei Emeltchenko @ 2012-05-03  8:18 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

On Thu, May 03, 2012 at 10:55:52AM +0300, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Remove magic number unneeded calculation since
> hlen = L2CAP_HDR_SIZE + L2CAP_PSMLEN_SIZE

Since Gustavo removed hlen I'll do the same.

Best regards 
Andrei Emeltchenko 

> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/l2cap_core.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 07a09cc..1748c3c 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -1922,8 +1922,8 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
>  	/* Create L2CAP header */
>  	lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
>  	lh->cid = cpu_to_le16(chan->dcid);
> -	lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE));
> -	put_unaligned(chan->psm, skb_put(skb, 2));
> +	lh->len = cpu_to_le16(len + L2CAP_PSMLEN_SIZE);
> +	put_unaligned(chan->psm, skb_put(skb, L2CAP_PSMLEN_SIZE));
>  
>  	err = l2cap_skbuff_fromiovec(chan, msg, len, count, skb);
>  	if (unlikely(err < 0)) {
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: Remove unneeded calculation and magic number
  2012-05-03  8:18 ` Andrei Emeltchenko
@ 2012-05-03  8:28   ` Andrei Emeltchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andrei Emeltchenko @ 2012-05-03  8:28 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

On Thu, May 03, 2012 at 11:18:21AM +0300, Andrei Emeltchenko wrote:
> Hi,
> 
> On Thu, May 03, 2012 at 10:55:52AM +0300, Andrei Emeltchenko wrote:
> > From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> > 
> > Remove magic number unneeded calculation since
> > hlen = L2CAP_HDR_SIZE + L2CAP_PSMLEN_SIZE
> 
> Since Gustavo removed hlen I'll do the same.

I think now that patch good enough as is

Best regards 
Andrei Emeltchenko 

> 
> Best regards 
> Andrei Emeltchenko 
> 
> > 
> > Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> > ---
> >  net/bluetooth/l2cap_core.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> > index 07a09cc..1748c3c 100644
> > --- a/net/bluetooth/l2cap_core.c
> > +++ b/net/bluetooth/l2cap_core.c
> > @@ -1922,8 +1922,8 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
> >  	/* Create L2CAP header */
> >  	lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
> >  	lh->cid = cpu_to_le16(chan->dcid);
> > -	lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE));
> > -	put_unaligned(chan->psm, skb_put(skb, 2));
> > +	lh->len = cpu_to_le16(len + L2CAP_PSMLEN_SIZE);
> > +	put_unaligned(chan->psm, skb_put(skb, L2CAP_PSMLEN_SIZE));
> >  
> >  	err = l2cap_skbuff_fromiovec(chan, msg, len, count, skb);
> >  	if (unlikely(err < 0)) {
> > -- 
> > 1.7.9.5
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] Bluetooth: Remove unneeded calculation and magic number
@ 2012-05-04  7:29 Andrei Emeltchenko
  2012-05-06 16:03 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Andrei Emeltchenko @ 2012-05-04  7:29 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Remove magic number unneeded calculation since
hlen = L2CAP_HDR_SIZE + L2CAP_PSMLEN_SIZE

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/l2cap_core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index edc9a37..7ea00d3 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1875,8 +1875,8 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
 	/* Create L2CAP header */
 	lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
 	lh->cid = cpu_to_le16(chan->dcid);
-	lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE));
-	put_unaligned(chan->psm, skb_put(skb, 2));
+	lh->len = cpu_to_le16(len + L2CAP_PSMLEN_SIZE);
+	put_unaligned(chan->psm, skb_put(skb, L2CAP_PSMLEN_SIZE));
 
 	err = l2cap_skbuff_fromiovec(chan, msg, len, count, skb);
 	if (unlikely(err < 0)) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: Remove unneeded calculation and magic number
  2012-05-03  7:55 Andrei Emeltchenko
  2012-05-03  8:18 ` Andrei Emeltchenko
@ 2012-05-04 19:23 ` Gustavo Padovan
  1 sibling, 0 replies; 6+ messages in thread
From: Gustavo Padovan @ 2012-05-04 19:23 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-05-03 10:55:52 +0300]:

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Remove magic number unneeded calculation since
> hlen = L2CAP_HDR_SIZE + L2CAP_PSMLEN_SIZE
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/l2cap_core.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch has been applied. Thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: Remove unneeded calculation and magic number
  2012-05-04  7:29 [PATCH] Bluetooth: Remove unneeded calculation and magic number Andrei Emeltchenko
@ 2012-05-06 16:03 ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2012-05-06 16:03 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> Remove magic number unneeded calculation since
> hlen = L2CAP_HDR_SIZE + L2CAP_PSMLEN_SIZE
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/l2cap_core.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-06 16:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-04  7:29 [PATCH] Bluetooth: Remove unneeded calculation and magic number Andrei Emeltchenko
2012-05-06 16:03 ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2012-05-03  7:55 Andrei Emeltchenko
2012-05-03  8:18 ` Andrei Emeltchenko
2012-05-03  8:28   ` Andrei Emeltchenko
2012-05-04 19:23 ` Gustavo Padovan

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).