diff options
-rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 6 | ||||
-rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 6 | ||||
-rw-r--r-- | drivers/bluetooth/btuart_cs.c | 6 | ||||
-rw-r--r-- | drivers/bluetooth/hci_h4.c | 6 | ||||
-rw-r--r-- | include/net/bluetooth/hci.h | 18 |
5 files changed, 30 insertions, 12 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index acfb6a430dcc..851de4d5b7de 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -461,20 +461,20 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset) | |||
461 | switch (info->rx_state) { | 461 | switch (info->rx_state) { |
462 | 462 | ||
463 | case RECV_WAIT_EVENT_HEADER: | 463 | case RECV_WAIT_EVENT_HEADER: |
464 | eh = (struct hci_event_hdr *)(info->rx_skb->data); | 464 | eh = hci_event_hdr(info->rx_skb); |
465 | info->rx_state = RECV_WAIT_DATA; | 465 | info->rx_state = RECV_WAIT_DATA; |
466 | info->rx_count = eh->plen; | 466 | info->rx_count = eh->plen; |
467 | break; | 467 | break; |
468 | 468 | ||
469 | case RECV_WAIT_ACL_HEADER: | 469 | case RECV_WAIT_ACL_HEADER: |
470 | ah = (struct hci_acl_hdr *)(info->rx_skb->data); | 470 | ah = hci_acl_hdr(info->rx_skb); |
471 | dlen = __le16_to_cpu(ah->dlen); | 471 | dlen = __le16_to_cpu(ah->dlen); |
472 | info->rx_state = RECV_WAIT_DATA; | 472 | info->rx_state = RECV_WAIT_DATA; |
473 | info->rx_count = dlen; | 473 | info->rx_count = dlen; |
474 | break; | 474 | break; |
475 | 475 | ||
476 | case RECV_WAIT_SCO_HEADER: | 476 | case RECV_WAIT_SCO_HEADER: |
477 | sh = (struct hci_sco_hdr *)(info->rx_skb->data); | 477 | sh = hci_sco_hdr(info->rx_skb); |
478 | info->rx_state = RECV_WAIT_DATA; | 478 | info->rx_state = RECV_WAIT_DATA; |
479 | info->rx_count = sh->dlen; | 479 | info->rx_count = sh->dlen; |
480 | break; | 480 | break; |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 18b0f3992c5b..39516074636b 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -303,20 +303,20 @@ static void bt3c_receive(bt3c_info_t *info) | |||
303 | switch (info->rx_state) { | 303 | switch (info->rx_state) { |
304 | 304 | ||
305 | case RECV_WAIT_EVENT_HEADER: | 305 | case RECV_WAIT_EVENT_HEADER: |
306 | eh = (struct hci_event_hdr *)(info->rx_skb->data); | 306 | eh = hci_event_hdr(info->rx_skb); |
307 | info->rx_state = RECV_WAIT_DATA; | 307 | info->rx_state = RECV_WAIT_DATA; |
308 | info->rx_count = eh->plen; | 308 | info->rx_count = eh->plen; |
309 | break; | 309 | break; |
310 | 310 | ||
311 | case RECV_WAIT_ACL_HEADER: | 311 | case RECV_WAIT_ACL_HEADER: |
312 | ah = (struct hci_acl_hdr *)(info->rx_skb->data); | 312 | ah = hci_acl_hdr(info->rx_skb); |
313 | dlen = __le16_to_cpu(ah->dlen); | 313 | dlen = __le16_to_cpu(ah->dlen); |
314 | info->rx_state = RECV_WAIT_DATA; | 314 | info->rx_state = RECV_WAIT_DATA; |
315 | info->rx_count = dlen; | 315 | info->rx_count = dlen; |
316 | break; | 316 | break; |
317 | 317 | ||
318 | case RECV_WAIT_SCO_HEADER: | 318 | case RECV_WAIT_SCO_HEADER: |
319 | sh = (struct hci_sco_hdr *)(info->rx_skb->data); | 319 | sh = hci_sco_hdr(info->rx_skb); |
320 | info->rx_state = RECV_WAIT_DATA; | 320 | info->rx_state = RECV_WAIT_DATA; |
321 | info->rx_count = sh->dlen; | 321 | info->rx_count = sh->dlen; |
322 | break; | 322 | break; |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index c1bce75148fe..d7d2ea0d86a1 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -250,20 +250,20 @@ static void btuart_receive(btuart_info_t *info) | |||
250 | switch (info->rx_state) { | 250 | switch (info->rx_state) { |
251 | 251 | ||
252 | case RECV_WAIT_EVENT_HEADER: | 252 | case RECV_WAIT_EVENT_HEADER: |
253 | eh = (struct hci_event_hdr *)(info->rx_skb->data); | 253 | eh = hci_event_hdr(info->rx_skb); |
254 | info->rx_state = RECV_WAIT_DATA; | 254 | info->rx_state = RECV_WAIT_DATA; |
255 | info->rx_count = eh->plen; | 255 | info->rx_count = eh->plen; |
256 | break; | 256 | break; |
257 | 257 | ||
258 | case RECV_WAIT_ACL_HEADER: | 258 | case RECV_WAIT_ACL_HEADER: |
259 | ah = (struct hci_acl_hdr *)(info->rx_skb->data); | 259 | ah = hci_acl_hdr(info->rx_skb); |
260 | dlen = __le16_to_cpu(ah->dlen); | 260 | dlen = __le16_to_cpu(ah->dlen); |
261 | info->rx_state = RECV_WAIT_DATA; | 261 | info->rx_state = RECV_WAIT_DATA; |
262 | info->rx_count = dlen; | 262 | info->rx_count = dlen; |
263 | break; | 263 | break; |
264 | 264 | ||
265 | case RECV_WAIT_SCO_HEADER: | 265 | case RECV_WAIT_SCO_HEADER: |
266 | sh = (struct hci_sco_hdr *)(info->rx_skb->data); | 266 | sh = hci_sco_hdr(info->rx_skb); |
267 | info->rx_state = RECV_WAIT_DATA; | 267 | info->rx_state = RECV_WAIT_DATA; |
268 | info->rx_count = sh->dlen; | 268 | info->rx_count = sh->dlen; |
269 | break; | 269 | break; |
diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c index 34f0afc42407..bfbae14cf93d 100644 --- a/drivers/bluetooth/hci_h4.c +++ b/drivers/bluetooth/hci_h4.c | |||
@@ -188,7 +188,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count) | |||
188 | continue; | 188 | continue; |
189 | 189 | ||
190 | case H4_W4_EVENT_HDR: | 190 | case H4_W4_EVENT_HDR: |
191 | eh = (struct hci_event_hdr *) h4->rx_skb->data; | 191 | eh = hci_event_hdr(h4->rx_skb); |
192 | 192 | ||
193 | BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen); | 193 | BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen); |
194 | 194 | ||
@@ -196,7 +196,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count) | |||
196 | continue; | 196 | continue; |
197 | 197 | ||
198 | case H4_W4_ACL_HDR: | 198 | case H4_W4_ACL_HDR: |
199 | ah = (struct hci_acl_hdr *) h4->rx_skb->data; | 199 | ah = hci_acl_hdr(h4->rx_skb); |
200 | dlen = __le16_to_cpu(ah->dlen); | 200 | dlen = __le16_to_cpu(ah->dlen); |
201 | 201 | ||
202 | BT_DBG("ACL header: dlen %d", dlen); | 202 | BT_DBG("ACL header: dlen %d", dlen); |
@@ -205,7 +205,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count) | |||
205 | continue; | 205 | continue; |
206 | 206 | ||
207 | case H4_W4_SCO_HDR: | 207 | case H4_W4_SCO_HDR: |
208 | sh = (struct hci_sco_hdr *) h4->rx_skb->data; | 208 | sh = hci_sco_hdr(h4->rx_skb); |
209 | 209 | ||
210 | BT_DBG("SCO header: dlen %d", sh->dlen); | 210 | BT_DBG("SCO header: dlen %d", sh->dlen); |
211 | 211 | ||
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 41456c148842..93ce272a5d27 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -709,6 +709,24 @@ struct hci_sco_hdr { | |||
709 | __u8 dlen; | 709 | __u8 dlen; |
710 | } __attribute__ ((packed)); | 710 | } __attribute__ ((packed)); |
711 | 711 | ||
712 | #ifdef __KERNEL__ | ||
713 | #include <linux/skbuff.h> | ||
714 | static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) | ||
715 | { | ||
716 | return (struct hci_event_hdr *)skb->data; | ||
717 | } | ||
718 | |||
719 | static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) | ||
720 | { | ||
721 | return (struct hci_acl_hdr *)skb->data; | ||
722 | } | ||
723 | |||
724 | static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) | ||
725 | { | ||
726 | return (struct hci_sco_hdr *)skb->data; | ||
727 | } | ||
728 | #endif | ||
729 | |||
712 | /* Command opcode pack/unpack */ | 730 | /* Command opcode pack/unpack */ |
713 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) | 731 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) |
714 | #define hci_opcode_ogf(op) (op >> 10) | 732 | #define hci_opcode_ogf(op) (op >> 10) |