aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/bnep/core.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2011-03-21 09:19:58 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-03-31 13:22:55 -0400
commit3aad75a128e2f2b8da31de1df4b9b9b4a8f65c66 (patch)
tree195fc4178c30a517862d29bb002f65ef49025c76 /net/bluetooth/bnep/core.c
parenta3d9bd4c00f13defd4c0fdcf8b47f8764a69e54d (diff)
Bluetooth: Fix checkpatch errors and some code style issues in bnep
Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/bnep/core.c')
-rw-r--r--net/bluetooth/bnep/core.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 940b4e129741..0a2e76bde542 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -131,7 +131,8 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len
131 return -EILSEQ; 131 return -EILSEQ;
132 132
133 n = get_unaligned_be16(data); 133 n = get_unaligned_be16(data);
134 data++; len -= 2; 134 data++;
135 len -= 2;
135 136
136 if (len < n) 137 if (len < n)
137 return -EILSEQ; 138 return -EILSEQ;
@@ -176,7 +177,8 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
176 return -EILSEQ; 177 return -EILSEQ;
177 178
178 n = get_unaligned_be16(data); 179 n = get_unaligned_be16(data);
179 data += 2; len -= 2; 180 data += 2;
181 len -= 2;
180 182
181 if (len < n) 183 if (len < n)
182 return -EILSEQ; 184 return -EILSEQ;
@@ -198,8 +200,10 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
198 for (; n > 0; n--) { 200 for (; n > 0; n--) {
199 u8 a1[6], *a2; 201 u8 a1[6], *a2;
200 202
201 memcpy(a1, data, ETH_ALEN); data += ETH_ALEN; 203 memcpy(a1, data, ETH_ALEN);
202 a2 = data; data += ETH_ALEN; 204 data += ETH_ALEN;
205 a2 = data;
206 data += ETH_ALEN;
203 207
204 BT_DBG("mc filter %s -> %s", 208 BT_DBG("mc filter %s -> %s",
205 batostr((void *) a1), batostr((void *) a2)); 209 batostr((void *) a1), batostr((void *) a2));
@@ -231,7 +235,8 @@ static int bnep_rx_control(struct bnep_session *s, void *data, int len)
231 u8 cmd = *(u8 *)data; 235 u8 cmd = *(u8 *)data;
232 int err = 0; 236 int err = 0;
233 237
234 data++; len--; 238 data++;
239 len--;
235 240
236 switch (cmd) { 241 switch (cmd) {
237 case BNEP_CMD_NOT_UNDERSTOOD: 242 case BNEP_CMD_NOT_UNDERSTOOD:
@@ -315,7 +320,8 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
315 320
316 dev->stats.rx_bytes += skb->len; 321 dev->stats.rx_bytes += skb->len;
317 322
318 type = *(u8 *) skb->data; skb_pull(skb, 1); 323 type = *(u8 *) skb->data;
324 skb_pull(skb, 1);
319 325
320 if ((type & BNEP_TYPE_MASK) >= sizeof(__bnep_rx_hlen)) 326 if ((type & BNEP_TYPE_MASK) >= sizeof(__bnep_rx_hlen))
321 goto badframe; 327 goto badframe;
@@ -370,14 +376,14 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
370 376
371 case BNEP_COMPRESSED_DST_ONLY: 377 case BNEP_COMPRESSED_DST_ONLY:
372 memcpy(__skb_put(nskb, ETH_ALEN), skb_mac_header(skb), 378 memcpy(__skb_put(nskb, ETH_ALEN), skb_mac_header(skb),
373 ETH_ALEN); 379 ETH_ALEN);
374 memcpy(__skb_put(nskb, ETH_ALEN + 2), s->eh.h_source, 380 memcpy(__skb_put(nskb, ETH_ALEN + 2), s->eh.h_source,
375 ETH_ALEN + 2); 381 ETH_ALEN + 2);
376 break; 382 break;
377 383
378 case BNEP_GENERAL: 384 case BNEP_GENERAL:
379 memcpy(__skb_put(nskb, ETH_ALEN * 2), skb_mac_header(skb), 385 memcpy(__skb_put(nskb, ETH_ALEN * 2), skb_mac_header(skb),
380 ETH_ALEN * 2); 386 ETH_ALEN * 2);
381 put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2)); 387 put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2));
382 break; 388 break;
383 } 389 }
@@ -481,7 +487,7 @@ static int bnep_session(void *arg)
481 while (!atomic_read(&s->killed)) { 487 while (!atomic_read(&s->killed)) {
482 set_current_state(TASK_INTERRUPTIBLE); 488 set_current_state(TASK_INTERRUPTIBLE);
483 489
484 // RX 490 /* RX */
485 while ((skb = skb_dequeue(&sk->sk_receive_queue))) { 491 while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
486 skb_orphan(skb); 492 skb_orphan(skb);
487 bnep_rx_frame(s, skb); 493 bnep_rx_frame(s, skb);
@@ -490,7 +496,7 @@ static int bnep_session(void *arg)
490 if (sk->sk_state != BT_CONNECTED) 496 if (sk->sk_state != BT_CONNECTED)
491 break; 497 break;
492 498
493 // TX 499 /* TX */
494 while ((skb = skb_dequeue(&sk->sk_write_queue))) 500 while ((skb = skb_dequeue(&sk->sk_write_queue)))
495 if (bnep_tx_frame(s, skb)) 501 if (bnep_tx_frame(s, skb))
496 break; 502 break;
@@ -558,8 +564,8 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
558 564
559 /* session struct allocated as private part of net_device */ 565 /* session struct allocated as private part of net_device */
560 dev = alloc_netdev(sizeof(struct bnep_session), 566 dev = alloc_netdev(sizeof(struct bnep_session),
561 (*req->device) ? req->device : "bnep%d", 567 (*req->device) ? req->device : "bnep%d",
562 bnep_net_setup); 568 bnep_net_setup);
563 if (!dev) 569 if (!dev)
564 return -ENOMEM; 570 return -ENOMEM;
565 571
@@ -574,7 +580,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
574 s = netdev_priv(dev); 580 s = netdev_priv(dev);
575 581
576 /* This is rx header therefore addresses are swapped. 582 /* This is rx header therefore addresses are swapped.
577 * ie eh.h_dest is our local address. */ 583 * ie. eh.h_dest is our local address. */
578 memcpy(s->eh.h_dest, &src, ETH_ALEN); 584 memcpy(s->eh.h_dest, &src, ETH_ALEN);
579 memcpy(s->eh.h_source, &dst, ETH_ALEN); 585 memcpy(s->eh.h_source, &dst, ETH_ALEN);
580 memcpy(dev->dev_addr, s->eh.h_dest, ETH_ALEN); 586 memcpy(dev->dev_addr, s->eh.h_dest, ETH_ALEN);
@@ -600,9 +606,8 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
600 SET_NETDEV_DEVTYPE(dev, &bnep_type); 606 SET_NETDEV_DEVTYPE(dev, &bnep_type);
601 607
602 err = register_netdev(dev); 608 err = register_netdev(dev);
603 if (err) { 609 if (err)
604 goto failed; 610 goto failed;
605 }
606 611
607 __bnep_link_session(s); 612 __bnep_link_session(s);
608 613