diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-10-11 09:19:18 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-11 09:28:03 -0400 |
commit | 7bd8f09f69f8a190f9b8334a07bb0a9237612314 (patch) | |
tree | a5d892d5129194953e29eb9dc986f5773e59ef14 /drivers/bluetooth | |
parent | e1a26170692dc1e5fbe0ccd98ef86cc9fcd31a64 (diff) |
Bluetooth: Add hdev parameter to hdev->send driver callback
Instead of masking hdev inside the skb->dev parameter, hand it
directly to the driver as a parameter to hdev->send. This makes
the driver interface more clear and simpler.
This patch fixes all drivers to accept and handle the new parameter
of hdev->send callback. Special care has been taken for bpa10x
and btusb drivers that require having skb->dev set to hdev for
the URB transmit complete handlers.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/bfusb.c | 3 | ||||
-rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 3 | ||||
-rw-r--r-- | drivers/bluetooth/bpa10x.c | 5 | ||||
-rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 3 | ||||
-rw-r--r-- | drivers/bluetooth/btmrvl_main.c | 4 | ||||
-rw-r--r-- | drivers/bluetooth/btsdio.c | 3 | ||||
-rw-r--r-- | drivers/bluetooth/btuart_cs.c | 3 | ||||
-rw-r--r-- | drivers/bluetooth/btusb.c | 5 | ||||
-rw-r--r-- | drivers/bluetooth/btwilink.c | 5 | ||||
-rw-r--r-- | drivers/bluetooth/dtl1_cs.c | 3 | ||||
-rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 3 | ||||
-rw-r--r-- | drivers/bluetooth/hci_ll.c | 1 | ||||
-rw-r--r-- | drivers/bluetooth/hci_vhci.c | 3 |
13 files changed, 16 insertions, 28 deletions
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index b7b5bb879f08..a6758490fa61 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c | |||
@@ -464,9 +464,8 @@ static int bfusb_close(struct hci_dev *hdev) | |||
464 | return 0; | 464 | return 0; |
465 | } | 465 | } |
466 | 466 | ||
467 | static int bfusb_send_frame(struct sk_buff *skb) | 467 | static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
468 | { | 468 | { |
469 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | ||
470 | struct bfusb_data *data; | 469 | struct bfusb_data *data; |
471 | struct sk_buff *nskb; | 470 | struct sk_buff *nskb; |
472 | unsigned char buf[3]; | 471 | unsigned char buf[3]; |
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 395acde99d78..9194a1ba897f 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -658,10 +658,9 @@ static int bluecard_hci_close(struct hci_dev *hdev) | |||
658 | } | 658 | } |
659 | 659 | ||
660 | 660 | ||
661 | static int bluecard_hci_send_frame(struct sk_buff *skb) | 661 | static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
662 | { | 662 | { |
663 | bluecard_info_t *info; | 663 | bluecard_info_t *info; |
664 | struct hci_dev *hdev = (struct hci_dev *)(skb->dev); | ||
665 | 664 | ||
666 | if (!hdev) { | 665 | if (!hdev) { |
667 | BT_ERR("Frame for unknown HCI device (hdev=NULL)"); | 666 | BT_ERR("Frame for unknown HCI device (hdev=NULL)"); |
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index 3188fb48bf4b..b9e4e621fb10 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c | |||
@@ -350,9 +350,8 @@ static int bpa10x_flush(struct hci_dev *hdev) | |||
350 | return 0; | 350 | return 0; |
351 | } | 351 | } |
352 | 352 | ||
353 | static int bpa10x_send_frame(struct sk_buff *skb) | 353 | static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
354 | { | 354 | { |
355 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | ||
356 | struct bpa10x_data *data = hci_get_drvdata(hdev); | 355 | struct bpa10x_data *data = hci_get_drvdata(hdev); |
357 | struct usb_ctrlrequest *dr; | 356 | struct usb_ctrlrequest *dr; |
358 | struct urb *urb; | 357 | struct urb *urb; |
@@ -364,6 +363,8 @@ static int bpa10x_send_frame(struct sk_buff *skb) | |||
364 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | 363 | if (!test_bit(HCI_RUNNING, &hdev->flags)) |
365 | return -EBUSY; | 364 | return -EBUSY; |
366 | 365 | ||
366 | skb->dev = (void *) hdev; | ||
367 | |||
367 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 368 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
368 | if (!urb) | 369 | if (!urb) |
369 | return -ENOMEM; | 370 | return -ENOMEM; |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index d8e4b0d7926e..fcd5fe993ad0 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -415,10 +415,9 @@ static int bt3c_hci_close(struct hci_dev *hdev) | |||
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | static int bt3c_hci_send_frame(struct sk_buff *skb) | 418 | static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
419 | { | 419 | { |
420 | bt3c_info_t *info; | 420 | bt3c_info_t *info; |
421 | struct hci_dev *hdev = (struct hci_dev *)(skb->dev); | ||
422 | unsigned long flags; | 421 | unsigned long flags; |
423 | 422 | ||
424 | if (!hdev) { | 423 | if (!hdev) { |
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index 8ac4d938d89c..547a447149d3 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c | |||
@@ -187,7 +187,6 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 cmd_no, | |||
187 | 187 | ||
188 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; | 188 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; |
189 | 189 | ||
190 | skb->dev = (void *) priv->btmrvl_dev.hcidev; | ||
191 | skb_queue_head(&priv->adapter->tx_queue, skb); | 190 | skb_queue_head(&priv->adapter->tx_queue, skb); |
192 | 191 | ||
193 | priv->btmrvl_dev.sendcmdflag = true; | 192 | priv->btmrvl_dev.sendcmdflag = true; |
@@ -356,9 +355,8 @@ static void btmrvl_free_adapter(struct btmrvl_private *priv) | |||
356 | priv->adapter = NULL; | 355 | priv->adapter = NULL; |
357 | } | 356 | } |
358 | 357 | ||
359 | static int btmrvl_send_frame(struct sk_buff *skb) | 358 | static int btmrvl_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
360 | { | 359 | { |
361 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | ||
362 | struct btmrvl_private *priv = NULL; | 360 | struct btmrvl_private *priv = NULL; |
363 | 361 | ||
364 | BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len); | 362 | BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len); |
diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c index 72fe49e60359..b61440aaee65 100644 --- a/drivers/bluetooth/btsdio.c +++ b/drivers/bluetooth/btsdio.c | |||
@@ -254,9 +254,8 @@ static int btsdio_flush(struct hci_dev *hdev) | |||
254 | return 0; | 254 | return 0; |
255 | } | 255 | } |
256 | 256 | ||
257 | static int btsdio_send_frame(struct sk_buff *skb) | 257 | static int btsdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
258 | { | 258 | { |
259 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | ||
260 | struct btsdio_data *data = hci_get_drvdata(hdev); | 259 | struct btsdio_data *data = hci_get_drvdata(hdev); |
261 | 260 | ||
262 | BT_DBG("%s", hdev->name); | 261 | BT_DBG("%s", hdev->name); |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index d0b89ecf1c59..f567cd8424c3 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -423,10 +423,9 @@ static int btuart_hci_close(struct hci_dev *hdev) | |||
423 | } | 423 | } |
424 | 424 | ||
425 | 425 | ||
426 | static int btuart_hci_send_frame(struct sk_buff *skb) | 426 | static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
427 | { | 427 | { |
428 | btuart_info_t *info; | 428 | btuart_info_t *info; |
429 | struct hci_dev *hdev = (struct hci_dev *)(skb->dev); | ||
430 | 429 | ||
431 | if (!hdev) { | 430 | if (!hdev) { |
432 | BT_ERR("Frame for unknown HCI device (hdev=NULL)"); | 431 | BT_ERR("Frame for unknown HCI device (hdev=NULL)"); |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index faa429f7d8a1..621069cb3053 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -716,9 +716,8 @@ static int btusb_flush(struct hci_dev *hdev) | |||
716 | return 0; | 716 | return 0; |
717 | } | 717 | } |
718 | 718 | ||
719 | static int btusb_send_frame(struct sk_buff *skb) | 719 | static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
720 | { | 720 | { |
721 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | ||
722 | struct btusb_data *data = hci_get_drvdata(hdev); | 721 | struct btusb_data *data = hci_get_drvdata(hdev); |
723 | struct usb_ctrlrequest *dr; | 722 | struct usb_ctrlrequest *dr; |
724 | struct urb *urb; | 723 | struct urb *urb; |
@@ -730,6 +729,8 @@ static int btusb_send_frame(struct sk_buff *skb) | |||
730 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | 729 | if (!test_bit(HCI_RUNNING, &hdev->flags)) |
731 | return -EBUSY; | 730 | return -EBUSY; |
732 | 731 | ||
732 | skb->dev = (void *) hdev; | ||
733 | |||
733 | switch (bt_cb(skb)->pkt_type) { | 734 | switch (bt_cb(skb)->pkt_type) { |
734 | case HCI_COMMAND_PKT: | 735 | case HCI_COMMAND_PKT: |
735 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 736 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c index 5e10fb0a7e05..f038dba19e36 100644 --- a/drivers/bluetooth/btwilink.c +++ b/drivers/bluetooth/btwilink.c | |||
@@ -251,14 +251,11 @@ static int ti_st_close(struct hci_dev *hdev) | |||
251 | return err; | 251 | return err; |
252 | } | 252 | } |
253 | 253 | ||
254 | static int ti_st_send_frame(struct sk_buff *skb) | 254 | static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
255 | { | 255 | { |
256 | struct hci_dev *hdev; | ||
257 | struct ti_st *hst; | 256 | struct ti_st *hst; |
258 | long len; | 257 | long len; |
259 | 258 | ||
260 | hdev = (struct hci_dev *)skb->dev; | ||
261 | |||
262 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | 259 | if (!test_bit(HCI_RUNNING, &hdev->flags)) |
263 | return -EBUSY; | 260 | return -EBUSY; |
264 | 261 | ||
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 29451413bc04..ad1a2f9dc772 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -382,10 +382,9 @@ static int dtl1_hci_close(struct hci_dev *hdev) | |||
382 | } | 382 | } |
383 | 383 | ||
384 | 384 | ||
385 | static int dtl1_hci_send_frame(struct sk_buff *skb) | 385 | static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
386 | { | 386 | { |
387 | dtl1_info_t *info; | 387 | dtl1_info_t *info; |
388 | struct hci_dev *hdev = (struct hci_dev *)(skb->dev); | ||
389 | struct sk_buff *s; | 388 | struct sk_buff *s; |
390 | nsh_t nsh; | 389 | nsh_t nsh; |
391 | 390 | ||
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index bc68a440d432..b04054675c48 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -234,9 +234,8 @@ static int hci_uart_close(struct hci_dev *hdev) | |||
234 | } | 234 | } |
235 | 235 | ||
236 | /* Send frames from HCI layer */ | 236 | /* Send frames from HCI layer */ |
237 | static int hci_uart_send_frame(struct sk_buff *skb) | 237 | static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
238 | { | 238 | { |
239 | struct hci_dev* hdev = (struct hci_dev *) skb->dev; | ||
240 | struct hci_uart *hu; | 239 | struct hci_uart *hu; |
241 | 240 | ||
242 | if (!hdev) { | 241 | if (!hdev) { |
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c index 58a9541feba6..69a90b1b5ff5 100644 --- a/drivers/bluetooth/hci_ll.c +++ b/drivers/bluetooth/hci_ll.c | |||
@@ -110,7 +110,6 @@ static int send_hcill_cmd(u8 cmd, struct hci_uart *hu) | |||
110 | /* prepare packet */ | 110 | /* prepare packet */ |
111 | hcill_packet = (struct hcill_cmd *) skb_put(skb, 1); | 111 | hcill_packet = (struct hcill_cmd *) skb_put(skb, 1); |
112 | hcill_packet->cmd = cmd; | 112 | hcill_packet->cmd = cmd; |
113 | skb->dev = (void *) hu->hdev; | ||
114 | 113 | ||
115 | /* send packet */ | 114 | /* send packet */ |
116 | skb_queue_tail(&ll->txq, skb); | 115 | skb_queue_tail(&ll->txq, skb); |
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 0fd522e85a71..e6f591969d95 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c | |||
@@ -81,9 +81,8 @@ static int vhci_flush(struct hci_dev *hdev) | |||
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | 83 | ||
84 | static int vhci_send_frame(struct sk_buff *skb) | 84 | static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) |
85 | { | 85 | { |
86 | struct hci_dev* hdev = (struct hci_dev *) skb->dev; | ||
87 | struct vhci_data *data; | 86 | struct vhci_data *data; |
88 | 87 | ||
89 | if (!hdev) { | 88 | if (!hdev) { |