Commit 8805eea2 authored by Maxim Zhukov's avatar Maxim Zhukov Committed by Marcel Holtmann

Bluetooth: hci_bcsp: fix code style

This commit fixed:
trailing "*/"
trailing spaces
mixed indent
space between ~ and (
Signed-off-by: default avatarMaxim Zhukov <mussitantesmortem@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent cd9d7213
...@@ -102,13 +102,12 @@ static const u16 crc_table[] = { ...@@ -102,13 +102,12 @@ static const u16 crc_table[] = {
/* Initialise the crc calculator */ /* Initialise the crc calculator */
#define BCSP_CRC_INIT(x) x = 0xffff #define BCSP_CRC_INIT(x) x = 0xffff
/* /* Update crc with next data byte
Update crc with next data byte *
* Implementation note
Implementation note * The data byte is treated as two nibbles. The crc is generated
The data byte is treated as two nibbles. The crc is generated * in reverse, i.e., bits are fed into the register from the top.
in reverse, i.e., bits are fed into the register from the top. */
*/
static void bcsp_crc_update(u16 *crc, u8 d) static void bcsp_crc_update(u16 *crc, u8 d)
{ {
u16 reg = *crc; u16 reg = *crc;
...@@ -223,9 +222,10 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data, ...@@ -223,9 +222,10 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
} }
/* Max len of packet: (original len +4(bcsp hdr) +2(crc))*2 /* Max len of packet: (original len +4(bcsp hdr) +2(crc))*2
(because bytes 0xc0 and 0xdb are escaped, worst case is * (because bytes 0xc0 and 0xdb are escaped, worst case is
when the packet is all made of 0xc0 and 0xdb :) ) * when the packet is all made of 0xc0 and 0xdb :) )
+ 2 (0xc0 delimiters at start and end). */ * + 2 (0xc0 delimiters at start and end).
*/
nskb = alloc_skb((len + 6) * 2 + 2, GFP_ATOMIC); nskb = alloc_skb((len + 6) * 2 + 2, GFP_ATOMIC);
if (!nskb) if (!nskb)
...@@ -305,8 +305,9 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu) ...@@ -305,8 +305,9 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
} }
/* Now, try to send a reliable pkt. We can only send a /* Now, try to send a reliable pkt. We can only send a
reliable packet if the number of packets sent but not yet ack'ed * reliable packet if the number of packets sent but not yet ack'ed
is < than the winsize */ * is < than the winsize
*/
spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING); spin_lock_irqsave_nested(&bcsp->unack.lock, flags, SINGLE_DEPTH_NESTING);
...@@ -332,12 +333,14 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu) ...@@ -332,12 +333,14 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
spin_unlock_irqrestore(&bcsp->unack.lock, flags); spin_unlock_irqrestore(&bcsp->unack.lock, flags);
/* We could not send a reliable packet, either because there are /* We could not send a reliable packet, either because there are
none or because there are too many unack'ed pkts. Did we receive * none or because there are too many unack'ed pkts. Did we receive
any packets we have not acknowledged yet ? */ * any packets we have not acknowledged yet ?
*/
if (bcsp->txack_req) { if (bcsp->txack_req) {
/* if so, craft an empty ACK pkt and send it on BCSP unreliable /* if so, craft an empty ACK pkt and send it on BCSP unreliable
channel 0 */ * channel 0
*/
struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, NULL, 0, BCSP_ACK_PKT); struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, NULL, 0, BCSP_ACK_PKT);
return nskb; return nskb;
} }
...@@ -399,8 +402,9 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp) ...@@ -399,8 +402,9 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)
} }
/* Handle BCSP link-establishment packets. When we /* Handle BCSP link-establishment packets. When we
detect a "sync" packet, symptom that the BT module has reset, * detect a "sync" packet, symptom that the BT module has reset,
we do nothing :) (yet) */ * we do nothing :) (yet)
*/
static void bcsp_handle_le_pkt(struct hci_uart *hu) static void bcsp_handle_le_pkt(struct hci_uart *hu)
{ {
struct bcsp_struct *bcsp = hu->priv; struct bcsp_struct *bcsp = hu->priv;
...@@ -615,7 +619,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count) ...@@ -615,7 +619,7 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
case BCSP_W4_CRC: case BCSP_W4_CRC:
if (bitrev16(bcsp->message_crc) != bscp_get_crc(bcsp)) { if (bitrev16(bcsp->message_crc) != bscp_get_crc(bcsp)) {
BT_ERR ("Checksum failed: computed %04x received %04x", BT_ERR("Checksum failed: computed %04x received %04x",
bitrev16(bcsp->message_crc), bitrev16(bcsp->message_crc),
bscp_get_crc(bcsp)); bscp_get_crc(bcsp));
...@@ -654,7 +658,8 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count) ...@@ -654,7 +658,8 @@ static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
/* Do not increment ptr or decrement count /* Do not increment ptr or decrement count
* Allocate packet. Max len of a BCSP pkt= * Allocate packet. Max len of a BCSP pkt=
* 0xFFF (payload) +4 (header) +2 (crc) */ * 0xFFF (payload) +4 (header) +2 (crc)
*/
bcsp->rx_skb = bt_skb_alloc(0x1005, GFP_ATOMIC); bcsp->rx_skb = bt_skb_alloc(0x1005, GFP_ATOMIC);
if (!bcsp->rx_skb) { if (!bcsp->rx_skb) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment