aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-10-10 19:52:43 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-10-11 03:45:34 -0400
commite1a26170692dc1e5fbe0ccd98ef86cc9fcd31a64 (patch)
treee0960ade9f09c39dc44c92604e7f758760ea1fce /drivers
parent8909f6d2c450d0a878bcb1d1184ed0114c5724c9 (diff)
Bluetooth: Provide hdev parameter to hci_recv_frame() driver callback
To avoid casting skb->dev into hdev, just let the drivers provide the hdev directly when calling hci_recv_frame() function. This patch also fixes up all drivers to provide the hdev. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bluetooth/bfusb.c3
-rw-r--r--drivers/bluetooth/bluecard_cs.c3
-rw-r--r--drivers/bluetooth/bpa10x.c4
-rw-r--r--drivers/bluetooth/bt3c_cs.c3
-rw-r--r--drivers/bluetooth/btmrvl_sdio.c8
-rw-r--r--drivers/bluetooth/btsdio.c3
-rw-r--r--drivers/bluetooth/btuart_cs.c3
-rw-r--r--drivers/bluetooth/btwilink.c4
-rw-r--r--drivers/bluetooth/dtl1_cs.c3
-rw-r--r--drivers/bluetooth/hci_bcsp.c5
-rw-r--r--drivers/bluetooth/hci_h5.c2
-rw-r--r--drivers/bluetooth/hci_ll.c13
-rw-r--r--drivers/bluetooth/hci_vhci.c3
13 files changed, 21 insertions, 36 deletions
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 66faad0c6237..b7b5bb879f08 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -318,7 +318,6 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
318 return -ENOMEM; 318 return -ENOMEM;
319 } 319 }
320 320
321 skb->dev = (void *) data->hdev;
322 bt_cb(skb)->pkt_type = pkt_type; 321 bt_cb(skb)->pkt_type = pkt_type;
323 322
324 data->reassembly = skb; 323 data->reassembly = skb;
@@ -333,7 +332,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
333 memcpy(skb_put(data->reassembly, len), buf, len); 332 memcpy(skb_put(data->reassembly, len), buf, len);
334 333
335 if (hdr & 0x08) { 334 if (hdr & 0x08) {
336 hci_recv_frame(data->reassembly); 335 hci_recv_frame(data->hdev, data->reassembly);
337 data->reassembly = NULL; 336 data->reassembly = NULL;
338 } 337 }
339 338
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index aa872c9b3fc2..395acde99d78 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -399,7 +399,6 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
399 399
400 if (info->rx_state == RECV_WAIT_PACKET_TYPE) { 400 if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
401 401
402 info->rx_skb->dev = (void *) info->hdev;
403 bt_cb(info->rx_skb)->pkt_type = buf[i]; 402 bt_cb(info->rx_skb)->pkt_type = buf[i];
404 403
405 switch (bt_cb(info->rx_skb)->pkt_type) { 404 switch (bt_cb(info->rx_skb)->pkt_type) {
@@ -477,7 +476,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
477 break; 476 break;
478 477
479 case RECV_WAIT_DATA: 478 case RECV_WAIT_DATA:
480 hci_recv_frame(info->rx_skb); 479 hci_recv_frame(info->hdev, info->rx_skb);
481 info->rx_skb = NULL; 480 info->rx_skb = NULL;
482 break; 481 break;
483 482
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index 2fe4a8031348..3188fb48bf4b 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -129,8 +129,6 @@ static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count)
129 return -ENOMEM; 129 return -ENOMEM;
130 } 130 }
131 131
132 skb->dev = (void *) hdev;
133
134 data->rx_skb[queue] = skb; 132 data->rx_skb[queue] = skb;
135 133
136 scb = (void *) skb->cb; 134 scb = (void *) skb->cb;
@@ -155,7 +153,7 @@ static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count)
155 data->rx_skb[queue] = NULL; 153 data->rx_skb[queue] = NULL;
156 154
157 bt_cb(skb)->pkt_type = scb->type; 155 bt_cb(skb)->pkt_type = scb->type;
158 hci_recv_frame(skb); 156 hci_recv_frame(hdev, skb);
159 } 157 }
160 158
161 count -= len; buf += len; 159 count -= len; buf += len;
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 673455cbde4c..d8e4b0d7926e 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -247,7 +247,6 @@ static void bt3c_receive(bt3c_info_t *info)
247 247
248 if (info->rx_state == RECV_WAIT_PACKET_TYPE) { 248 if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
249 249
250 info->rx_skb->dev = (void *) info->hdev;
251 bt_cb(info->rx_skb)->pkt_type = inb(iobase + DATA_L); 250 bt_cb(info->rx_skb)->pkt_type = inb(iobase + DATA_L);
252 inb(iobase + DATA_H); 251 inb(iobase + DATA_H);
253 //printk("bt3c: PACKET_TYPE=%02x\n", bt_cb(info->rx_skb)->pkt_type); 252 //printk("bt3c: PACKET_TYPE=%02x\n", bt_cb(info->rx_skb)->pkt_type);
@@ -318,7 +317,7 @@ static void bt3c_receive(bt3c_info_t *info)
318 break; 317 break;
319 318
320 case RECV_WAIT_DATA: 319 case RECV_WAIT_DATA:
321 hci_recv_frame(info->rx_skb); 320 hci_recv_frame(info->hdev, info->rx_skb);
322 info->rx_skb = NULL; 321 info->rx_skb = NULL;
323 break; 322 break;
324 323
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 332475e400cf..fabcf5bb48af 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -600,15 +600,14 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
600 case HCI_SCODATA_PKT: 600 case HCI_SCODATA_PKT:
601 case HCI_EVENT_PKT: 601 case HCI_EVENT_PKT:
602 bt_cb(skb)->pkt_type = type; 602 bt_cb(skb)->pkt_type = type;
603 skb->dev = (void *)hdev;
604 skb_put(skb, buf_len); 603 skb_put(skb, buf_len);
605 skb_pull(skb, SDIO_HEADER_LEN); 604 skb_pull(skb, SDIO_HEADER_LEN);
606 605
607 if (type == HCI_EVENT_PKT) { 606 if (type == HCI_EVENT_PKT) {
608 if (btmrvl_check_evtpkt(priv, skb)) 607 if (btmrvl_check_evtpkt(priv, skb))
609 hci_recv_frame(skb); 608 hci_recv_frame(hdev, skb);
610 } else { 609 } else {
611 hci_recv_frame(skb); 610 hci_recv_frame(hdev, skb);
612 } 611 }
613 612
614 hdev->stat.byte_rx += buf_len; 613 hdev->stat.byte_rx += buf_len;
@@ -616,12 +615,11 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
616 615
617 case MRVL_VENDOR_PKT: 616 case MRVL_VENDOR_PKT:
618 bt_cb(skb)->pkt_type = HCI_VENDOR_PKT; 617 bt_cb(skb)->pkt_type = HCI_VENDOR_PKT;
619 skb->dev = (void *)hdev;
620 skb_put(skb, buf_len); 618 skb_put(skb, buf_len);
621 skb_pull(skb, SDIO_HEADER_LEN); 619 skb_pull(skb, SDIO_HEADER_LEN);
622 620
623 if (btmrvl_process_event(priv, skb)) 621 if (btmrvl_process_event(priv, skb))
624 hci_recv_frame(skb); 622 hci_recv_frame(hdev, skb);
625 623
626 hdev->stat.byte_rx += buf_len; 624 hdev->stat.byte_rx += buf_len;
627 break; 625 break;
diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c
index 4a9909713874..72fe49e60359 100644
--- a/drivers/bluetooth/btsdio.c
+++ b/drivers/bluetooth/btsdio.c
@@ -157,10 +157,9 @@ static int btsdio_rx_packet(struct btsdio_data *data)
157 157
158 data->hdev->stat.byte_rx += len; 158 data->hdev->stat.byte_rx += len;
159 159
160 skb->dev = (void *) data->hdev;
161 bt_cb(skb)->pkt_type = hdr[3]; 160 bt_cb(skb)->pkt_type = hdr[3];
162 161
163 err = hci_recv_frame(skb); 162 err = hci_recv_frame(data->hdev, skb);
164 if (err < 0) 163 if (err < 0)
165 return err; 164 return err;
166 165
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 970e2d3dd3c2..d0b89ecf1c59 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -198,7 +198,6 @@ static void btuart_receive(btuart_info_t *info)
198 198
199 if (info->rx_state == RECV_WAIT_PACKET_TYPE) { 199 if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
200 200
201 info->rx_skb->dev = (void *) info->hdev;
202 bt_cb(info->rx_skb)->pkt_type = inb(iobase + UART_RX); 201 bt_cb(info->rx_skb)->pkt_type = inb(iobase + UART_RX);
203 202
204 switch (bt_cb(info->rx_skb)->pkt_type) { 203 switch (bt_cb(info->rx_skb)->pkt_type) {
@@ -265,7 +264,7 @@ static void btuart_receive(btuart_info_t *info)
265 break; 264 break;
266 265
267 case RECV_WAIT_DATA: 266 case RECV_WAIT_DATA:
268 hci_recv_frame(info->rx_skb); 267 hci_recv_frame(info->hdev, info->rx_skb);
269 info->rx_skb = NULL; 268 info->rx_skb = NULL;
270 break; 269 break;
271 270
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
index 60abf596f60e..5e10fb0a7e05 100644
--- a/drivers/bluetooth/btwilink.c
+++ b/drivers/bluetooth/btwilink.c
@@ -108,10 +108,8 @@ static long st_receive(void *priv_data, struct sk_buff *skb)
108 return -EFAULT; 108 return -EFAULT;
109 } 109 }
110 110
111 skb->dev = (void *) lhst->hdev;
112
113 /* Forward skb to HCI core layer */ 111 /* Forward skb to HCI core layer */
114 err = hci_recv_frame(skb); 112 err = hci_recv_frame(lhst->hdev, skb);
115 if (err < 0) { 113 if (err < 0) {
116 BT_ERR("Unable to push skb to HCI core(%d)", err); 114 BT_ERR("Unable to push skb to HCI core(%d)", err);
117 return err; 115 return err;
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index c43aff8ec995..29451413bc04 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -256,9 +256,8 @@ static void dtl1_receive(dtl1_info_t *info)
256 case 0x83: 256 case 0x83:
257 case 0x84: 257 case 0x84:
258 /* send frame to the HCI layer */ 258 /* send frame to the HCI layer */
259 info->rx_skb->dev = (void *) info->hdev;
260 bt_cb(info->rx_skb)->pkt_type &= 0x0f; 259 bt_cb(info->rx_skb)->pkt_type &= 0x0f;
261 hci_recv_frame(info->rx_skb); 260 hci_recv_frame(info->hdev, info->rx_skb);
262 break; 261 break;
263 default: 262 default:
264 /* unknown packet */ 263 /* unknown packet */
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index 57e502e06080..0bc87f7abd95 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -522,7 +522,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
522 memcpy(skb_push(bcsp->rx_skb, HCI_EVENT_HDR_SIZE), &hdr, HCI_EVENT_HDR_SIZE); 522 memcpy(skb_push(bcsp->rx_skb, HCI_EVENT_HDR_SIZE), &hdr, HCI_EVENT_HDR_SIZE);
523 bt_cb(bcsp->rx_skb)->pkt_type = HCI_EVENT_PKT; 523 bt_cb(bcsp->rx_skb)->pkt_type = HCI_EVENT_PKT;
524 524
525 hci_recv_frame(bcsp->rx_skb); 525 hci_recv_frame(hu->hdev, bcsp->rx_skb);
526 } else { 526 } else {
527 BT_ERR ("Packet for unknown channel (%u %s)", 527 BT_ERR ("Packet for unknown channel (%u %s)",
528 bcsp->rx_skb->data[1] & 0x0f, 528 bcsp->rx_skb->data[1] & 0x0f,
@@ -536,7 +536,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
536 /* Pull out BCSP hdr */ 536 /* Pull out BCSP hdr */
537 skb_pull(bcsp->rx_skb, 4); 537 skb_pull(bcsp->rx_skb, 4);
538 538
539 hci_recv_frame(bcsp->rx_skb); 539 hci_recv_frame(hu->hdev, bcsp->rx_skb);
540 } 540 }
541 541
542 bcsp->rx_state = BCSP_W4_PKT_DELIMITER; 542 bcsp->rx_state = BCSP_W4_PKT_DELIMITER;
@@ -655,7 +655,6 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)
655 bcsp->rx_count = 0; 655 bcsp->rx_count = 0;
656 return 0; 656 return 0;
657 } 657 }
658 bcsp->rx_skb->dev = (void *) hu->hdev;
659 break; 658 break;
660 } 659 }
661 break; 660 break;
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index b6154d5a07a5..f6f497450560 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -340,7 +340,7 @@ static void h5_complete_rx_pkt(struct hci_uart *hu)
340 /* Remove Three-wire header */ 340 /* Remove Three-wire header */
341 skb_pull(h5->rx_skb, 4); 341 skb_pull(h5->rx_skb, 4);
342 342
343 hci_recv_frame(h5->rx_skb); 343 hci_recv_frame(hu->hdev, h5->rx_skb);
344 h5->rx_skb = NULL; 344 h5->rx_skb = NULL;
345 345
346 break; 346 break;
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index cfc767938589..58a9541feba6 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -346,14 +346,14 @@ static int ll_enqueue(struct hci_uart *hu, struct sk_buff *skb)
346 return 0; 346 return 0;
347} 347}
348 348
349static inline int ll_check_data_len(struct ll_struct *ll, int len) 349static inline int ll_check_data_len(struct hci_dev *hdev, struct ll_struct *ll, int len)
350{ 350{
351 int room = skb_tailroom(ll->rx_skb); 351 int room = skb_tailroom(ll->rx_skb);
352 352
353 BT_DBG("len %d room %d", len, room); 353 BT_DBG("len %d room %d", len, room);
354 354
355 if (!len) { 355 if (!len) {
356 hci_recv_frame(ll->rx_skb); 356 hci_recv_frame(hdev, ll->rx_skb);
357 } else if (len > room) { 357 } else if (len > room) {
358 BT_ERR("Data length is too large"); 358 BT_ERR("Data length is too large");
359 kfree_skb(ll->rx_skb); 359 kfree_skb(ll->rx_skb);
@@ -395,7 +395,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
395 switch (ll->rx_state) { 395 switch (ll->rx_state) {
396 case HCILL_W4_DATA: 396 case HCILL_W4_DATA:
397 BT_DBG("Complete data"); 397 BT_DBG("Complete data");
398 hci_recv_frame(ll->rx_skb); 398 hci_recv_frame(hu->hdev, ll->rx_skb);
399 399
400 ll->rx_state = HCILL_W4_PACKET_TYPE; 400 ll->rx_state = HCILL_W4_PACKET_TYPE;
401 ll->rx_skb = NULL; 401 ll->rx_skb = NULL;
@@ -406,7 +406,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
406 406
407 BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen); 407 BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen);
408 408
409 ll_check_data_len(ll, eh->plen); 409 ll_check_data_len(hu->hdev, ll, eh->plen);
410 continue; 410 continue;
411 411
412 case HCILL_W4_ACL_HDR: 412 case HCILL_W4_ACL_HDR:
@@ -415,7 +415,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
415 415
416 BT_DBG("ACL header: dlen %d", dlen); 416 BT_DBG("ACL header: dlen %d", dlen);
417 417
418 ll_check_data_len(ll, dlen); 418 ll_check_data_len(hu->hdev, ll, dlen);
419 continue; 419 continue;
420 420
421 case HCILL_W4_SCO_HDR: 421 case HCILL_W4_SCO_HDR:
@@ -423,7 +423,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
423 423
424 BT_DBG("SCO header: dlen %d", sh->dlen); 424 BT_DBG("SCO header: dlen %d", sh->dlen);
425 425
426 ll_check_data_len(ll, sh->dlen); 426 ll_check_data_len(hu->hdev, ll, sh->dlen);
427 continue; 427 continue;
428 } 428 }
429 } 429 }
@@ -494,7 +494,6 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
494 return -ENOMEM; 494 return -ENOMEM;
495 } 495 }
496 496
497 ll->rx_skb->dev = (void *) hu->hdev;
498 bt_cb(ll->rx_skb)->pkt_type = type; 497 bt_cb(ll->rx_skb)->pkt_type = type;
499 } 498 }
500 499
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index c04a3e6fb37c..0fd522e85a71 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -179,10 +179,9 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
179 return -ENODEV; 179 return -ENODEV;
180 } 180 }
181 181
182 skb->dev = (void *) data->hdev;
183 bt_cb(skb)->pkt_type = pkt_type; 182 bt_cb(skb)->pkt_type = pkt_type;
184 183
185 ret = hci_recv_frame(skb); 184 ret = hci_recv_frame(data->hdev, skb);
186 break; 185 break;
187 186
188 case HCI_VENDOR_PKT: 187 case HCI_VENDOR_PKT: