aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 00:04:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 00:04:44 -0400
commitf8965467f366fd18f01feafb5db10512d7b4422c (patch)
tree3706a9cd779859271ca61b85c63a1bc3f82d626e /drivers/bluetooth
parenta26272e5200765691e67d6780e52b32498fdb659 (diff)
parent2ec8c6bb5d8f3a62a79f463525054bae1e3d4487 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1674 commits) qlcnic: adding co maintainer ixgbe: add support for active DA cables ixgbe: dcb, do not tag tc_prio_control frames ixgbe: fix ixgbe_tx_is_paused logic ixgbe: always enable vlan strip/insert when DCB is enabled ixgbe: remove some redundant code in setting FCoE FIP filter ixgbe: fix wrong offset to fc_frame_header in ixgbe_fcoe_ddp ixgbe: fix header len when unsplit packet overflows to data buffer ipv6: Never schedule DAD timer on dead address ipv6: Use POSTDAD state ipv6: Use state_lock to protect ifa state ipv6: Replace inet6_ifaddr->dead with state cxgb4: notify upper drivers if the device is already up when they load cxgb4: keep interrupts available when the ports are brought down cxgb4: fix initial addition of MAC address cnic: Return SPQ credit to bnx2x after ring setup and shutdown. cnic: Convert cnic_local_flags to atomic ops. can: Fix SJA1000 command register writes on SMP systems bridge: fix build for CONFIG_SYSFS disabled ARCNET: Limit com20020 PCI ID matches for SOHARD cards ... Fix up various conflicts with pcmcia tree drivers/net/ {pcmcia/3c589_cs.c, wireless/orinoco/orinoco_cs.c and wireless/orinoco/spectrum_cs.c} and feature removal (Documentation/feature-removal-schedule.txt). Also fix a non-content conflict due to pm_qos_requirement getting renamed in the PM tree (now pm_qos_request) in net/mac80211/scan.c
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btmrvl_drv.h8
-rw-r--r--drivers/bluetooth/btmrvl_main.c92
-rw-r--r--drivers/bluetooth/btmrvl_sdio.c7
-rw-r--r--drivers/bluetooth/hci_h4.c2
-rw-r--r--drivers/bluetooth/hci_ll.c8
-rw-r--r--drivers/bluetooth/hci_vhci.c2
6 files changed, 76 insertions, 43 deletions
diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h
index 204727586ee9..bed0ba630235 100644
--- a/drivers/bluetooth/btmrvl_drv.h
+++ b/drivers/bluetooth/btmrvl_drv.h
@@ -42,6 +42,8 @@ struct btmrvl_device {
42 void *card; 42 void *card;
43 struct hci_dev *hcidev; 43 struct hci_dev *hcidev;
44 44
45 u8 dev_type;
46
45 u8 tx_dnld_rdy; 47 u8 tx_dnld_rdy;
46 48
47 u8 psmode; 49 u8 psmode;
@@ -88,8 +90,11 @@ struct btmrvl_private {
88#define BT_CMD_HOST_SLEEP_ENABLE 0x5A 90#define BT_CMD_HOST_SLEEP_ENABLE 0x5A
89#define BT_CMD_MODULE_CFG_REQ 0x5B 91#define BT_CMD_MODULE_CFG_REQ 0x5B
90 92
91/* Sub-commands: Module Bringup/Shutdown Request */ 93/* Sub-commands: Module Bringup/Shutdown Request/Response */
92#define MODULE_BRINGUP_REQ 0xF1 94#define MODULE_BRINGUP_REQ 0xF1
95#define MODULE_BROUGHT_UP 0x00
96#define MODULE_ALREADY_UP 0x0C
97
93#define MODULE_SHUTDOWN_REQ 0xF2 98#define MODULE_SHUTDOWN_REQ 0xF2
94 99
95#define BT_EVENT_POWER_STATE 0x20 100#define BT_EVENT_POWER_STATE 0x20
@@ -123,6 +128,7 @@ struct btmrvl_event {
123 128
124/* Prototype of global function */ 129/* Prototype of global function */
125 130
131int btmrvl_register_hdev(struct btmrvl_private *priv);
126struct btmrvl_private *btmrvl_add_card(void *card); 132struct btmrvl_private *btmrvl_add_card(void *card);
127int btmrvl_remove_card(struct btmrvl_private *priv); 133int btmrvl_remove_card(struct btmrvl_private *priv);
128 134
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 53a43adf2e21..ee37ef0caee2 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -66,7 +66,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
66{ 66{
67 struct btmrvl_adapter *adapter = priv->adapter; 67 struct btmrvl_adapter *adapter = priv->adapter;
68 struct btmrvl_event *event; 68 struct btmrvl_event *event;
69 u8 ret = 0; 69 int ret = 0;
70 70
71 event = (struct btmrvl_event *) skb->data; 71 event = (struct btmrvl_event *) skb->data;
72 if (event->ec != 0xff) { 72 if (event->ec != 0xff) {
@@ -112,8 +112,17 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
112 case BT_CMD_MODULE_CFG_REQ: 112 case BT_CMD_MODULE_CFG_REQ:
113 if (priv->btmrvl_dev.sendcmdflag && 113 if (priv->btmrvl_dev.sendcmdflag &&
114 event->data[1] == MODULE_BRINGUP_REQ) { 114 event->data[1] == MODULE_BRINGUP_REQ) {
115 BT_DBG("EVENT:%s", (event->data[2]) ? 115 BT_DBG("EVENT:%s",
116 "Bring-up failed" : "Bring-up succeed"); 116 ((event->data[2] == MODULE_BROUGHT_UP) ||
117 (event->data[2] == MODULE_ALREADY_UP)) ?
118 "Bring-up succeed" : "Bring-up failed");
119
120 if (event->length > 3)
121 priv->btmrvl_dev.dev_type = event->data[3];
122 else
123 priv->btmrvl_dev.dev_type = HCI_BREDR;
124
125 BT_DBG("dev_type: %d", priv->btmrvl_dev.dev_type);
117 } else if (priv->btmrvl_dev.sendcmdflag && 126 } else if (priv->btmrvl_dev.sendcmdflag &&
118 event->data[1] == MODULE_SHUTDOWN_REQ) { 127 event->data[1] == MODULE_SHUTDOWN_REQ) {
119 BT_DBG("EVENT:%s", (event->data[2]) ? 128 BT_DBG("EVENT:%s", (event->data[2]) ?
@@ -522,47 +531,20 @@ static int btmrvl_service_main_thread(void *data)
522 return 0; 531 return 0;
523} 532}
524 533
525struct btmrvl_private *btmrvl_add_card(void *card) 534int btmrvl_register_hdev(struct btmrvl_private *priv)
526{ 535{
527 struct hci_dev *hdev = NULL; 536 struct hci_dev *hdev = NULL;
528 struct btmrvl_private *priv;
529 int ret; 537 int ret;
530 538
531 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
532 if (!priv) {
533 BT_ERR("Can not allocate priv");
534 goto err_priv;
535 }
536
537 priv->adapter = kzalloc(sizeof(*priv->adapter), GFP_KERNEL);
538 if (!priv->adapter) {
539 BT_ERR("Allocate buffer for btmrvl_adapter failed!");
540 goto err_adapter;
541 }
542
543 btmrvl_init_adapter(priv);
544
545 hdev = hci_alloc_dev(); 539 hdev = hci_alloc_dev();
546 if (!hdev) { 540 if (!hdev) {
547 BT_ERR("Can not allocate HCI device"); 541 BT_ERR("Can not allocate HCI device");
548 goto err_hdev; 542 goto err_hdev;
549 } 543 }
550 544
551 BT_DBG("Starting kthread...");
552 priv->main_thread.priv = priv;
553 spin_lock_init(&priv->driver_lock);
554
555 init_waitqueue_head(&priv->main_thread.wait_q);
556 priv->main_thread.task = kthread_run(btmrvl_service_main_thread,
557 &priv->main_thread, "btmrvl_main_service");
558
559 priv->btmrvl_dev.hcidev = hdev; 545 priv->btmrvl_dev.hcidev = hdev;
560 priv->btmrvl_dev.card = card;
561
562 hdev->driver_data = priv; 546 hdev->driver_data = priv;
563 547
564 priv->btmrvl_dev.tx_dnld_rdy = true;
565
566 hdev->bus = HCI_SDIO; 548 hdev->bus = HCI_SDIO;
567 hdev->open = btmrvl_open; 549 hdev->open = btmrvl_open;
568 hdev->close = btmrvl_close; 550 hdev->close = btmrvl_close;
@@ -572,6 +554,10 @@ struct btmrvl_private *btmrvl_add_card(void *card)
572 hdev->ioctl = btmrvl_ioctl; 554 hdev->ioctl = btmrvl_ioctl;
573 hdev->owner = THIS_MODULE; 555 hdev->owner = THIS_MODULE;
574 556
557 btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
558
559 hdev->dev_type = priv->btmrvl_dev.dev_type;
560
575 ret = hci_register_dev(hdev); 561 ret = hci_register_dev(hdev);
576 if (ret < 0) { 562 if (ret < 0) {
577 BT_ERR("Can not register HCI device"); 563 BT_ERR("Can not register HCI device");
@@ -582,16 +568,52 @@ struct btmrvl_private *btmrvl_add_card(void *card)
582 btmrvl_debugfs_init(hdev); 568 btmrvl_debugfs_init(hdev);
583#endif 569#endif
584 570
585 return priv; 571 return 0;
586 572
587err_hci_register_dev: 573err_hci_register_dev:
588 /* Stop the thread servicing the interrupts */
589 kthread_stop(priv->main_thread.task);
590
591 hci_free_dev(hdev); 574 hci_free_dev(hdev);
592 575
593err_hdev: 576err_hdev:
577 /* Stop the thread servicing the interrupts */
578 kthread_stop(priv->main_thread.task);
579
594 btmrvl_free_adapter(priv); 580 btmrvl_free_adapter(priv);
581 kfree(priv);
582
583 return -ENOMEM;
584}
585EXPORT_SYMBOL_GPL(btmrvl_register_hdev);
586
587struct btmrvl_private *btmrvl_add_card(void *card)
588{
589 struct btmrvl_private *priv;
590
591 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
592 if (!priv) {
593 BT_ERR("Can not allocate priv");
594 goto err_priv;
595 }
596
597 priv->adapter = kzalloc(sizeof(*priv->adapter), GFP_KERNEL);
598 if (!priv->adapter) {
599 BT_ERR("Allocate buffer for btmrvl_adapter failed!");
600 goto err_adapter;
601 }
602
603 btmrvl_init_adapter(priv);
604
605 BT_DBG("Starting kthread...");
606 priv->main_thread.priv = priv;
607 spin_lock_init(&priv->driver_lock);
608
609 init_waitqueue_head(&priv->main_thread.wait_q);
610 priv->main_thread.task = kthread_run(btmrvl_service_main_thread,
611 &priv->main_thread, "btmrvl_main_service");
612
613 priv->btmrvl_dev.card = card;
614 priv->btmrvl_dev.tx_dnld_rdy = true;
615
616 return priv;
595 617
596err_adapter: 618err_adapter:
597 kfree(priv); 619 kfree(priv);
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 0dba76aa2232..df0773ebd9e4 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -931,7 +931,12 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
931 priv->hw_host_to_card = btmrvl_sdio_host_to_card; 931 priv->hw_host_to_card = btmrvl_sdio_host_to_card;
932 priv->hw_wakeup_firmware = btmrvl_sdio_wakeup_fw; 932 priv->hw_wakeup_firmware = btmrvl_sdio_wakeup_fw;
933 933
934 btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ); 934 if (btmrvl_register_hdev(priv)) {
935 BT_ERR("Register hdev failed!");
936 ret = -ENODEV;
937 goto disable_host_int;
938 }
939
935 priv->btmrvl_dev.psmode = 1; 940 priv->btmrvl_dev.psmode = 1;
936 btmrvl_enable_ps(priv); 941 btmrvl_enable_ps(priv);
937 942
diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
index c0ce8134814e..3f038f5308a4 100644
--- a/drivers/bluetooth/hci_h4.c
+++ b/drivers/bluetooth/hci_h4.c
@@ -246,7 +246,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count)
246 BT_ERR("Can't allocate mem for new packet"); 246 BT_ERR("Can't allocate mem for new packet");
247 h4->rx_state = H4_W4_PACKET_TYPE; 247 h4->rx_state = H4_W4_PACKET_TYPE;
248 h4->rx_count = 0; 248 h4->rx_count = 0;
249 return 0; 249 return -ENOMEM;
250 } 250 }
251 251
252 h4->rx_skb->dev = (void *) hu->hdev; 252 h4->rx_skb->dev = (void *) hu->hdev;
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 5c65014635be..fb8445c7365e 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -402,7 +402,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
402 continue; 402 continue;
403 403
404 case HCILL_W4_EVENT_HDR: 404 case HCILL_W4_EVENT_HDR:
405 eh = (struct hci_event_hdr *) ll->rx_skb->data; 405 eh = hci_event_hdr(ll->rx_skb);
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
@@ -410,7 +410,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
410 continue; 410 continue;
411 411
412 case HCILL_W4_ACL_HDR: 412 case HCILL_W4_ACL_HDR:
413 ah = (struct hci_acl_hdr *) ll->rx_skb->data; 413 ah = hci_acl_hdr(ll->rx_skb);
414 dlen = __le16_to_cpu(ah->dlen); 414 dlen = __le16_to_cpu(ah->dlen);
415 415
416 BT_DBG("ACL header: dlen %d", dlen); 416 BT_DBG("ACL header: dlen %d", dlen);
@@ -419,7 +419,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
419 continue; 419 continue;
420 420
421 case HCILL_W4_SCO_HDR: 421 case HCILL_W4_SCO_HDR:
422 sh = (struct hci_sco_hdr *) ll->rx_skb->data; 422 sh = hci_sco_hdr(ll->rx_skb);
423 423
424 BT_DBG("SCO header: dlen %d", sh->dlen); 424 BT_DBG("SCO header: dlen %d", sh->dlen);
425 425
@@ -491,7 +491,7 @@ static int ll_recv(struct hci_uart *hu, void *data, int count)
491 BT_ERR("Can't allocate mem for new packet"); 491 BT_ERR("Can't allocate mem for new packet");
492 ll->rx_state = HCILL_W4_PACKET_TYPE; 492 ll->rx_state = HCILL_W4_PACKET_TYPE;
493 ll->rx_count = 0; 493 ll->rx_count = 0;
494 return 0; 494 return -ENOMEM;
495 } 495 }
496 496
497 ll->rx_skb->dev = (void *) hu->hdev; 497 ll->rx_skb->dev = (void *) hu->hdev;
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index bb0aefdb4267..3aa7b2a54b6f 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -157,7 +157,7 @@ static inline ssize_t vhci_put_user(struct vhci_data *data,
157 break; 157 break;
158 158
159 case HCI_SCODATA_PKT: 159 case HCI_SCODATA_PKT:
160 data->hdev->stat.cmd_tx++; 160 data->hdev->stat.sco_tx++;
161 break; 161 break;
162 }; 162 };
163 163