aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorMaxim Zhukov <mussitantesmortem@gmail.com>2016-04-08 16:54:51 -0400
committerMarcel Holtmann <marcel@holtmann.org>2016-04-08 17:01:36 -0400
commit8805eea2494a2837983bc4aaaf6842c89666ec25 (patch)
tree48d42581c2fcaaca8f27b981ef04809c1b077f49 /drivers/bluetooth
parentcd9d7213d5f546d9c0795fdcffe4ce5bf63445fd (diff)
Bluetooth: hci_bcsp: fix code style
This commit fixed: trailing "*/" trailing spaces mixed indent space between ~ and ( Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/hci_bcsp.c57
1 files changed, 31 insertions, 26 deletions
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index 064f2fefad62..d7d23ceba4d1 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -102,13 +102,12 @@ static const u16 crc_table[] = {
102/* Initialise the crc calculator */ 102/* Initialise the crc calculator */
103#define BCSP_CRC_INIT(x) x = 0xffff 103#define BCSP_CRC_INIT(x) x = 0xffff
104 104
105/* 105/* Update crc with next data byte
106 Update crc with next data byte 106 *
107 107 * Implementation note
108 Implementation note 108 * The data byte is treated as two nibbles. The crc is generated
109 The data byte is treated as two nibbles. The crc is generated 109 * in reverse, i.e., bits are fed into the register from the top.
110 in reverse, i.e., bits are fed into the register from the top. 110 */
111*/
112static void bcsp_crc_update(u16 *crc, u8 d) 111static void bcsp_crc_update(u16 *crc, u8 d)
113{ 112{
114 u16 reg = *crc; 113 u16 reg = *crc;
@@ -223,9 +222,10 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
223 } 222 }
224 223
225 /* Max len of packet: (original len +4(bcsp hdr) +2(crc))*2 224 /* Max len of packet: (original len +4(bcsp hdr) +2(crc))*2
226 (because bytes 0xc0 and 0xdb are escaped, worst case is 225 * (because bytes 0xc0 and 0xdb are escaped, worst case is
227 when the packet is all made of 0xc0 and 0xdb :) ) 226 * when the packet is all made of 0xc0 and 0xdb :) )
228 + 2 (0xc0 delimiters at start and end). */ 227 * + 2 (0xc0 delimiters at start and end).
228 */
229 229
230 nskb = alloc_skb((len + 6) * 2 + 2, GFP_ATOMIC); 230 nskb = alloc_skb((len + 6) * 2 + 2, GFP_ATOMIC);
231 if (!nskb) 231 if (!nskb)
@@ -285,7 +285,7 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
285 struct bcsp_struct *bcsp = hu->priv; 285 struct bcsp_struct *bcsp = hu->priv;
286 unsigned long flags; 286 unsigned long flags;
287 struct sk_buff *skb; 287 struct sk_buff *skb;
288 288
289 /* First of all, check for unreliable messages in the queue, 289 /* First of all, check for unreliable messages in the queue,
290 since they have priority */ 290 since they have priority */
291 291
@@ -305,8 +305,9 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
305 } 305 }
306 306
307 /* Now, try to send a reliable pkt. We can only send a 307 /* Now, try to send a reliable pkt. We can only send a
308 reliable packet if the number of packets sent but not yet ack'ed 308 * reliable packet if the number of packets sent but not yet ack'ed
309 is < than the winsize */ 309 * is < than the winsize
310 */
310 311
311 spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING); 312 spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
312 313
@@ -332,12 +333,14 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
332 spin_unlock_irqrestore(&bcsp->unack.lock, flags); 333 spin_unlock_irqrestore(&bcsp->unack.lock, flags);
333 334
334 /* We could not send a reliable packet, either because there are 335 /* We could not send a reliable packet, either because there are
335 none or because there are too many unack'ed pkts. Did we receive 336 * none or because there are too many unack'ed pkts. Did we receive
336 any packets we have not acknowledged yet ? */ 337 * any packets we have not acknowledged yet ?
338 */
337 339
338 if (bcsp->txack_req) { 340 if (bcsp->txack_req) {
339 /* if so, craft an empty ACK pkt and send it on BCSP unreliable 341 /* if so, craft an empty ACK pkt and send it on BCSP unreliable
340 channel 0 */ 342 * channel 0
343 */
341 struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, NULL, 0, BCSP_ACK_PKT); 344 struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, NULL, 0, BCSP_ACK_PKT);
342 return nskb; 345 return nskb;
343 } 346 }
@@ -399,8 +402,9 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
399} 402}
400 403
401/* Handle BCSP link-establishment packets. When we 404/* Handle BCSP link-establishment packets. When we
402 detect a "sync" packet, symptom that the BT module has reset, 405 * detect a "sync" packet, symptom that the BT module has reset,
403 we do nothing :) (yet) */ 406 * we do nothing :) (yet)
407 */
404static void bcsp_handle_le_pkt(struct hci_uart *hu) 408static void bcsp_handle_le_pkt(struct hci_uart *hu)
405{ 409{
406 struct bcsp_struct *bcsp = hu->priv; 410 struct bcsp_struct *bcsp = hu->priv;
@@ -462,7 +466,7 @@ static inline void bcsp_unslip_one_byte(struct bcsp_struct *bcsp, unsigned char
462 case 0xdd: 466 case 0xdd:
463 memcpy(skb_put(bcsp->rx_skb, 1), &db, 1); 467 memcpy(skb_put(bcsp->rx_skb, 1), &db, 1);
464 if ((bcsp->rx_skb->data[0] & 0x40) != 0 && 468 if ((bcsp->rx_skb->data[0] & 0x40) != 0 &&
465 bcsp->rx_state != BCSP_W4_CRC) 469 bcsp->rx_state != BCSP_W4_CRC)
466 bcsp_crc_update(&bcsp->message_crc, 0xdb); 470 bcsp_crc_update(&bcsp->message_crc, 0xdb);
467 bcsp->rx_esc_state = BCSP_ESCSTATE_NOESC; 471 bcsp->rx_esc_state = BCSP_ESCSTATE_NOESC;
468 bcsp->rx_count--; 472 bcsp->rx_count--;
@@ -534,7 +538,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
534 } else { 538 } else {
535 BT_ERR("Packet for unknown channel (%u %s)", 539 BT_ERR("Packet for unknown channel (%u %s)",
536 bcsp->rx_skb->data[1] & 0x0f, 540 bcsp->rx_skb->data[1] & 0x0f,
537 bcsp->rx_skb->data[0] & 0x80 ? 541 bcsp->rx_skb->data[0] & 0x80 ?
538 "reliable" : "unreliable"); 542 "reliable" : "unreliable");
539 kfree_skb(bcsp->rx_skb); 543 kfree_skb(bcsp->rx_skb);
540 } 544 }
@@ -562,7 +566,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
562 struct bcsp_struct *bcsp = hu->priv; 566 struct bcsp_struct *bcsp = hu->priv;
563 const unsigned char *ptr; 567 const unsigned char *ptr;
564 568
565 BT_DBG("hu %p count %d rx_state %d rx_count %ld", 569 BT_DBG("hu %p count %d rx_state %d rx_count %ld",
566 hu, count, bcsp->rx_state, bcsp->rx_count); 570 hu, count, bcsp->rx_state, bcsp->rx_count);
567 571
568 ptr = data; 572 ptr = data;
@@ -591,7 +595,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
591 continue; 595 continue;
592 } 596 }
593 if (bcsp->rx_skb->data[0] & 0x80 /* reliable pkt */ 597 if (bcsp->rx_skb->data[0] & 0x80 /* reliable pkt */
594 && (bcsp->rx_skb->data[0] & 0x07) != bcsp->rxseq_txack) { 598 && (bcsp->rx_skb->data[0] & 0x07) != bcsp->rxseq_txack) {
595 BT_ERR("Out-of-order packet arrived, got %u expected %u", 599 BT_ERR("Out-of-order packet arrived, got %u expected %u",
596 bcsp->rx_skb->data[0] & 0x07, bcsp->rxseq_txack); 600 bcsp->rx_skb->data[0] & 0x07, bcsp->rxseq_txack);
597 601
@@ -601,7 +605,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
601 continue; 605 continue;
602 } 606 }
603 bcsp->rx_state = BCSP_W4_DATA; 607 bcsp->rx_state = BCSP_W4_DATA;
604 bcsp->rx_count = (bcsp->rx_skb->data[1] >> 4) + 608 bcsp->rx_count = (bcsp->rx_skb->data[1] >> 4) +
605 (bcsp->rx_skb->data[2] << 4); /* May be 0 */ 609 (bcsp->rx_skb->data[2] << 4); /* May be 0 */
606 continue; 610 continue;
607 611
@@ -615,7 +619,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
615 619
616 case BCSP_W4_CRC: 620 case BCSP_W4_CRC:
617 if (bitrev16(bcsp->message_crc) != bscp_get_crc(bcsp)) { 621 if (bitrev16(bcsp->message_crc) != bscp_get_crc(bcsp)) {
618 BT_ERR ("Checksum failed: computed %04x received %04x", 622 BT_ERR("Checksum failed: computed %04x received %04x",
619 bitrev16(bcsp->message_crc), 623 bitrev16(bcsp->message_crc),
620 bscp_get_crc(bcsp)); 624 bscp_get_crc(bcsp));
621 625
@@ -653,8 +657,9 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
653 BCSP_CRC_INIT(bcsp->message_crc); 657 BCSP_CRC_INIT(bcsp->message_crc);
654 658
655 /* Do not increment ptr or decrement count 659 /* Do not increment ptr or decrement count
656 * Allocate packet. Max len of a BCSP pkt= 660 * Allocate packet. Max len of a BCSP pkt=
657 * 0xFFF (payload) +4 (header) +2 (crc) */ 661 * 0xFFF (payload) +4 (header) +2 (crc)
662 */
658 663
659 bcsp->rx_skb = bt_skb_alloc(0x1005, GFP_ATOMIC); 664 bcsp->rx_skb = bt_skb_alloc(0x1005, GFP_ATOMIC);
660 if (!bcsp->rx_skb) { 665 if (!bcsp->rx_skb) {