diff options
36 files changed, 209 insertions, 1559 deletions
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index 7cb4029a5375..1164837bb781 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig | |||
@@ -2,26 +2,6 @@ | |||
2 | menu "Bluetooth device drivers" | 2 | menu "Bluetooth device drivers" |
3 | depends on BT | 3 | depends on BT |
4 | 4 | ||
5 | config BT_HCIUSB | ||
6 | tristate "HCI USB driver (old version)" | ||
7 | depends on USB && BT_HCIBTUSB=n | ||
8 | help | ||
9 | Bluetooth HCI USB driver. | ||
10 | This driver is required if you want to use Bluetooth devices with | ||
11 | USB interface. | ||
12 | |||
13 | Say Y here to compile support for Bluetooth USB devices into the | ||
14 | kernel or say M to compile it as module (hci_usb). | ||
15 | |||
16 | config BT_HCIUSB_SCO | ||
17 | bool "SCO (voice) support" | ||
18 | depends on BT_HCIUSB | ||
19 | help | ||
20 | This option enables the SCO support in the HCI USB driver. You need this | ||
21 | to transmit voice data with your Bluetooth USB device. | ||
22 | |||
23 | Say Y here to compile support for SCO over HCI USB. | ||
24 | |||
25 | config BT_HCIBTUSB | 5 | config BT_HCIBTUSB |
26 | tristate "HCI USB driver" | 6 | tristate "HCI USB driver" |
27 | depends on USB | 7 | depends on USB |
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile index 77444afbf107..16930f93d1ca 100644 --- a/drivers/bluetooth/Makefile +++ b/drivers/bluetooth/Makefile | |||
@@ -2,7 +2,6 @@ | |||
2 | # Makefile for the Linux Bluetooth HCI device drivers. | 2 | # Makefile for the Linux Bluetooth HCI device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_BT_HCIUSB) += hci_usb.o | ||
6 | obj-$(CONFIG_BT_HCIVHCI) += hci_vhci.o | 5 | obj-$(CONFIG_BT_HCIVHCI) += hci_vhci.o |
7 | obj-$(CONFIG_BT_HCIUART) += hci_uart.o | 6 | obj-$(CONFIG_BT_HCIUART) += hci_uart.o |
8 | obj-$(CONFIG_BT_HCIBCM203X) += bcm203x.o | 7 | obj-$(CONFIG_BT_HCIBCM203X) += bcm203x.o |
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index ee40201c7278..eafd4af0746e 100644 --- a/drivers/bluetooth/bcm203x.c +++ b/drivers/bluetooth/bcm203x.c | |||
@@ -37,11 +37,6 @@ | |||
37 | 37 | ||
38 | #include <net/bluetooth/bluetooth.h> | 38 | #include <net/bluetooth/bluetooth.h> |
39 | 39 | ||
40 | #ifndef CONFIG_BT_HCIBCM203X_DEBUG | ||
41 | #undef BT_DBG | ||
42 | #define BT_DBG(D...) | ||
43 | #endif | ||
44 | |||
45 | #define VERSION "1.2" | 40 | #define VERSION "1.2" |
46 | 41 | ||
47 | static struct usb_device_id bcm203x_table[] = { | 42 | static struct usb_device_id bcm203x_table[] = { |
@@ -199,7 +194,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
199 | return -EIO; | 194 | return -EIO; |
200 | } | 195 | } |
201 | 196 | ||
202 | BT_DBG("minidrv data %p size %d", firmware->data, firmware->size); | 197 | BT_DBG("minidrv data %p size %zu", firmware->data, firmware->size); |
203 | 198 | ||
204 | size = max_t(uint, firmware->size, 4096); | 199 | size = max_t(uint, firmware->size, 4096); |
205 | 200 | ||
@@ -227,7 +222,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
227 | return -EIO; | 222 | return -EIO; |
228 | } | 223 | } |
229 | 224 | ||
230 | BT_DBG("firmware data %p size %d", firmware->data, firmware->size); | 225 | BT_DBG("firmware data %p size %zu", firmware->data, firmware->size); |
231 | 226 | ||
232 | data->fw_data = kmalloc(firmware->size, GFP_KERNEL); | 227 | data->fw_data = kmalloc(firmware->size, GFP_KERNEL); |
233 | if (!data->fw_data) { | 228 | if (!data->fw_data) { |
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 90a094634630..d3f14bee0f19 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c | |||
@@ -38,11 +38,6 @@ | |||
38 | #include <net/bluetooth/bluetooth.h> | 38 | #include <net/bluetooth/bluetooth.h> |
39 | #include <net/bluetooth/hci_core.h> | 39 | #include <net/bluetooth/hci_core.h> |
40 | 40 | ||
41 | #ifndef CONFIG_BT_HCIBFUSB_DEBUG | ||
42 | #undef BT_DBG | ||
43 | #define BT_DBG(D...) | ||
44 | #endif | ||
45 | |||
46 | #define VERSION "1.2" | 41 | #define VERSION "1.2" |
47 | 42 | ||
48 | static struct usb_driver bfusb_driver; | 43 | static struct usb_driver bfusb_driver; |
@@ -221,7 +216,7 @@ static int bfusb_rx_submit(struct bfusb_data *data, struct urb *urb) | |||
221 | struct sk_buff *skb; | 216 | struct sk_buff *skb; |
222 | int err, pipe, size = HCI_MAX_FRAME_SIZE + 32; | 217 | int err, pipe, size = HCI_MAX_FRAME_SIZE + 32; |
223 | 218 | ||
224 | BT_DBG("bfusb %p urb %p", bfusb, urb); | 219 | BT_DBG("bfusb %p urb %p", data, urb); |
225 | 220 | ||
226 | if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) | 221 | if (!urb && !(urb = usb_alloc_urb(0, GFP_ATOMIC))) |
227 | return -ENOMEM; | 222 | return -ENOMEM; |
@@ -354,7 +349,7 @@ static void bfusb_rx_complete(struct urb *urb) | |||
354 | int count = urb->actual_length; | 349 | int count = urb->actual_length; |
355 | int err, hdr, len; | 350 | int err, hdr, len; |
356 | 351 | ||
357 | BT_DBG("bfusb %p urb %p skb %p len %d", bfusb, urb, skb, skb->len); | 352 | BT_DBG("bfusb %p urb %p skb %p len %d", data, urb, skb, skb->len); |
358 | 353 | ||
359 | read_lock(&data->lock); | 354 | read_lock(&data->lock); |
360 | 355 | ||
@@ -691,7 +686,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
691 | goto error; | 686 | goto error; |
692 | } | 687 | } |
693 | 688 | ||
694 | BT_DBG("firmware data %p size %d", firmware->data, firmware->size); | 689 | BT_DBG("firmware data %p size %zu", firmware->data, firmware->size); |
695 | 690 | ||
696 | if (bfusb_load_firmware(data, firmware->data, firmware->size) < 0) { | 691 | if (bfusb_load_firmware(data, firmware->data, firmware->size) < 0) { |
697 | BT_ERR("Firmware loading failed"); | 692 | BT_ERR("Firmware loading failed"); |
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index b936d8ce2728..c115285867c3 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c | |||
@@ -35,11 +35,6 @@ | |||
35 | #include <net/bluetooth/bluetooth.h> | 35 | #include <net/bluetooth/bluetooth.h> |
36 | #include <net/bluetooth/hci_core.h> | 36 | #include <net/bluetooth/hci_core.h> |
37 | 37 | ||
38 | #ifndef CONFIG_BT_HCIBPA10X_DEBUG | ||
39 | #undef BT_DBG | ||
40 | #define BT_DBG(D...) | ||
41 | #endif | ||
42 | |||
43 | #define VERSION "0.10" | 38 | #define VERSION "0.10" |
44 | 39 | ||
45 | static struct usb_device_id bpa10x_table[] = { | 40 | static struct usb_device_id bpa10x_table[] = { |
@@ -489,6 +484,8 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * | |||
489 | 484 | ||
490 | hdev->owner = THIS_MODULE; | 485 | hdev->owner = THIS_MODULE; |
491 | 486 | ||
487 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); | ||
488 | |||
492 | err = hci_register_dev(hdev); | 489 | err = hci_register_dev(hdev); |
493 | if (err < 0) { | 490 | if (err < 0) { |
494 | hci_free_dev(hdev); | 491 | hci_free_dev(hdev); |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index b3e4d07a4ac2..ff195c230825 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -502,15 +502,15 @@ static int bt3c_load_firmware(bt3c_info_t *info, const unsigned char *firmware, | |||
502 | 502 | ||
503 | memset(b, 0, sizeof(b)); | 503 | memset(b, 0, sizeof(b)); |
504 | memcpy(b, ptr + 2, 2); | 504 | memcpy(b, ptr + 2, 2); |
505 | size = simple_strtol(b, NULL, 16); | 505 | size = simple_strtoul(b, NULL, 16); |
506 | 506 | ||
507 | memset(b, 0, sizeof(b)); | 507 | memset(b, 0, sizeof(b)); |
508 | memcpy(b, ptr + 4, 8); | 508 | memcpy(b, ptr + 4, 8); |
509 | addr = simple_strtol(b, NULL, 16); | 509 | addr = simple_strtoul(b, NULL, 16); |
510 | 510 | ||
511 | memset(b, 0, sizeof(b)); | 511 | memset(b, 0, sizeof(b)); |
512 | memcpy(b, ptr + (size * 2) + 2, 2); | 512 | memcpy(b, ptr + (size * 2) + 2, 2); |
513 | fcs = simple_strtol(b, NULL, 16); | 513 | fcs = simple_strtoul(b, NULL, 16); |
514 | 514 | ||
515 | memset(b, 0, sizeof(b)); | 515 | memset(b, 0, sizeof(b)); |
516 | for (tmp = 0, i = 0; i < size; i++) { | 516 | for (tmp = 0, i = 0; i < size; i++) { |
@@ -530,7 +530,7 @@ static int bt3c_load_firmware(bt3c_info_t *info, const unsigned char *firmware, | |||
530 | memset(b, 0, sizeof(b)); | 530 | memset(b, 0, sizeof(b)); |
531 | for (i = 0; i < (size - 4) / 2; i++) { | 531 | for (i = 0; i < (size - 4) / 2; i++) { |
532 | memcpy(b, ptr + (i * 4) + 12, 4); | 532 | memcpy(b, ptr + (i * 4) + 12, 4); |
533 | tmp = simple_strtol(b, NULL, 16); | 533 | tmp = simple_strtoul(b, NULL, 16); |
534 | bt3c_put(iobase, tmp); | 534 | bt3c_put(iobase, tmp); |
535 | } | 535 | } |
536 | } | 536 | } |
diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c index cda6c7cc944b..7e298275c8f6 100644 --- a/drivers/bluetooth/btsdio.c +++ b/drivers/bluetooth/btsdio.c | |||
@@ -37,11 +37,6 @@ | |||
37 | #include <net/bluetooth/bluetooth.h> | 37 | #include <net/bluetooth/bluetooth.h> |
38 | #include <net/bluetooth/hci_core.h> | 38 | #include <net/bluetooth/hci_core.h> |
39 | 39 | ||
40 | #ifndef CONFIG_BT_HCIBTSDIO_DEBUG | ||
41 | #undef BT_DBG | ||
42 | #define BT_DBG(D...) | ||
43 | #endif | ||
44 | |||
45 | #define VERSION "0.1" | 40 | #define VERSION "0.1" |
46 | 41 | ||
47 | static const struct sdio_device_id btsdio_table[] = { | 42 | static const struct sdio_device_id btsdio_table[] = { |
@@ -91,6 +86,7 @@ static int btsdio_tx_packet(struct btsdio_data *data, struct sk_buff *skb) | |||
91 | 86 | ||
92 | err = sdio_writesb(data->func, REG_TDAT, skb->data, skb->len); | 87 | err = sdio_writesb(data->func, REG_TDAT, skb->data, skb->len); |
93 | if (err < 0) { | 88 | if (err < 0) { |
89 | skb_pull(skb, 4); | ||
94 | sdio_writeb(data->func, 0x01, REG_PC_WRT, NULL); | 90 | sdio_writeb(data->func, 0x01, REG_PC_WRT, NULL); |
95 | return err; | 91 | return err; |
96 | } | 92 | } |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index af472e052732..b5fbda6d490a 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -35,31 +35,25 @@ | |||
35 | #include <net/bluetooth/bluetooth.h> | 35 | #include <net/bluetooth/bluetooth.h> |
36 | #include <net/bluetooth/hci_core.h> | 36 | #include <net/bluetooth/hci_core.h> |
37 | 37 | ||
38 | //#define CONFIG_BT_HCIBTUSB_DEBUG | 38 | #define VERSION "0.4" |
39 | #ifndef CONFIG_BT_HCIBTUSB_DEBUG | ||
40 | #undef BT_DBG | ||
41 | #define BT_DBG(D...) | ||
42 | #endif | ||
43 | |||
44 | #define VERSION "0.3" | ||
45 | 39 | ||
46 | static int ignore_dga; | 40 | static int ignore_dga; |
47 | static int ignore_csr; | 41 | static int ignore_csr; |
48 | static int ignore_sniffer; | 42 | static int ignore_sniffer; |
49 | static int disable_scofix; | 43 | static int disable_scofix; |
50 | static int force_scofix; | 44 | static int force_scofix; |
51 | static int reset; | 45 | |
46 | static int reset = 1; | ||
52 | 47 | ||
53 | static struct usb_driver btusb_driver; | 48 | static struct usb_driver btusb_driver; |
54 | 49 | ||
55 | #define BTUSB_IGNORE 0x01 | 50 | #define BTUSB_IGNORE 0x01 |
56 | #define BTUSB_RESET 0x02 | 51 | #define BTUSB_DIGIANSWER 0x02 |
57 | #define BTUSB_DIGIANSWER 0x04 | 52 | #define BTUSB_CSR 0x04 |
58 | #define BTUSB_CSR 0x08 | 53 | #define BTUSB_SNIFFER 0x08 |
59 | #define BTUSB_SNIFFER 0x10 | 54 | #define BTUSB_BCM92035 0x10 |
60 | #define BTUSB_BCM92035 0x20 | 55 | #define BTUSB_BROKEN_ISOC 0x20 |
61 | #define BTUSB_BROKEN_ISOC 0x40 | 56 | #define BTUSB_WRONG_SCO_MTU 0x40 |
62 | #define BTUSB_WRONG_SCO_MTU 0x80 | ||
63 | 57 | ||
64 | static struct usb_device_id btusb_table[] = { | 58 | static struct usb_device_id btusb_table[] = { |
65 | /* Generic Bluetooth USB device */ | 59 | /* Generic Bluetooth USB device */ |
@@ -79,7 +73,7 @@ static struct usb_device_id btusb_table[] = { | |||
79 | { USB_DEVICE(0x0bdb, 0x1002) }, | 73 | { USB_DEVICE(0x0bdb, 0x1002) }, |
80 | 74 | ||
81 | /* Canyon CN-BTU1 with HID interfaces */ | 75 | /* Canyon CN-BTU1 with HID interfaces */ |
82 | { USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_RESET }, | 76 | { USB_DEVICE(0x0c10, 0x0000) }, |
83 | 77 | ||
84 | { } /* Terminating entry */ | 78 | { } /* Terminating entry */ |
85 | }; | 79 | }; |
@@ -94,52 +88,37 @@ static struct usb_device_id blacklist_table[] = { | |||
94 | { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE }, | 88 | { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE }, |
95 | 89 | ||
96 | /* Broadcom BCM2035 */ | 90 | /* Broadcom BCM2035 */ |
97 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 91 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, |
98 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 92 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, |
93 | { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 }, | ||
99 | 94 | ||
100 | /* Broadcom BCM2045 */ | 95 | /* Broadcom BCM2045 */ |
101 | { USB_DEVICE(0x0a5c, 0x2039), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 96 | { USB_DEVICE(0x0a5c, 0x2039), .driver_info = BTUSB_WRONG_SCO_MTU }, |
102 | { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 97 | { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_WRONG_SCO_MTU }, |
103 | |||
104 | /* Broadcom BCM2046 */ | ||
105 | { USB_DEVICE(0x0a5c, 0x2146), .driver_info = BTUSB_RESET }, | ||
106 | { USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET }, | ||
107 | |||
108 | /* Apple MacBook Pro with Broadcom chip */ | ||
109 | { USB_DEVICE(0x05ac, 0x820f), .driver_info = BTUSB_RESET }, | ||
110 | 98 | ||
111 | /* IBM/Lenovo ThinkPad with Broadcom chip */ | 99 | /* IBM/Lenovo ThinkPad with Broadcom chip */ |
112 | { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 100 | { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_WRONG_SCO_MTU }, |
113 | { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 101 | { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_WRONG_SCO_MTU }, |
114 | |||
115 | /* Targus ACB10US */ | ||
116 | { USB_DEVICE(0x0a5c, 0x2100), .driver_info = BTUSB_RESET }, | ||
117 | { USB_DEVICE(0x0a5c, 0x2154), .driver_info = BTUSB_RESET }, | ||
118 | |||
119 | /* ANYCOM Bluetooth USB-200 and USB-250 */ | ||
120 | { USB_DEVICE(0x0a5c, 0x2111), .driver_info = BTUSB_RESET }, | ||
121 | 102 | ||
122 | /* HP laptop with Broadcom chip */ | 103 | /* HP laptop with Broadcom chip */ |
123 | { USB_DEVICE(0x03f0, 0x171d), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 104 | { USB_DEVICE(0x03f0, 0x171d), .driver_info = BTUSB_WRONG_SCO_MTU }, |
124 | 105 | ||
125 | /* Dell laptop with Broadcom chip */ | 106 | /* Dell laptop with Broadcom chip */ |
126 | { USB_DEVICE(0x413c, 0x8126), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 107 | { USB_DEVICE(0x413c, 0x8126), .driver_info = BTUSB_WRONG_SCO_MTU }, |
127 | 108 | ||
128 | /* Dell Wireless 370 */ | 109 | /* Dell Wireless 370 and 410 devices */ |
129 | { USB_DEVICE(0x413c, 0x8156), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 110 | { USB_DEVICE(0x413c, 0x8152), .driver_info = BTUSB_WRONG_SCO_MTU }, |
111 | { USB_DEVICE(0x413c, 0x8156), .driver_info = BTUSB_WRONG_SCO_MTU }, | ||
130 | 112 | ||
131 | /* Dell Wireless 410 */ | 113 | /* Belkin F8T012 and F8T013 devices */ |
132 | { USB_DEVICE(0x413c, 0x8152), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | 114 | { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_WRONG_SCO_MTU }, |
115 | { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_WRONG_SCO_MTU }, | ||
133 | 116 | ||
134 | /* Microsoft Wireless Transceiver for Bluetooth 2.0 */ | 117 | /* Asus WL-BTD202 device */ |
135 | { USB_DEVICE(0x045e, 0x009c), .driver_info = BTUSB_RESET }, | 118 | { USB_DEVICE(0x0b05, 0x1715), .driver_info = BTUSB_WRONG_SCO_MTU }, |
136 | 119 | ||
137 | /* Kensington Bluetooth USB adapter */ | 120 | /* Kensington Bluetooth USB adapter */ |
138 | { USB_DEVICE(0x047d, 0x105d), .driver_info = BTUSB_RESET }, | 121 | { USB_DEVICE(0x047d, 0x105e), .driver_info = BTUSB_WRONG_SCO_MTU }, |
139 | { USB_DEVICE(0x047d, 0x105e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | ||
140 | |||
141 | /* ISSC Bluetooth Adapter v3.1 */ | ||
142 | { USB_DEVICE(0x1131, 0x1001), .driver_info = BTUSB_RESET }, | ||
143 | 122 | ||
144 | /* RTX Telecom based adapters with buggy SCO support */ | 123 | /* RTX Telecom based adapters with buggy SCO support */ |
145 | { USB_DEVICE(0x0400, 0x0807), .driver_info = BTUSB_BROKEN_ISOC }, | 124 | { USB_DEVICE(0x0400, 0x0807), .driver_info = BTUSB_BROKEN_ISOC }, |
@@ -148,13 +127,6 @@ static struct usb_device_id blacklist_table[] = { | |||
148 | /* CONWISE Technology based adapters with buggy SCO support */ | 127 | /* CONWISE Technology based adapters with buggy SCO support */ |
149 | { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC }, | 128 | { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC }, |
150 | 129 | ||
151 | /* Belkin F8T012 and F8T013 devices */ | ||
152 | { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | ||
153 | { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, | ||
154 | |||
155 | /* Belkin F8T016 device */ | ||
156 | { USB_DEVICE(0x050d, 0x016a), .driver_info = BTUSB_RESET }, | ||
157 | |||
158 | /* Digianswer devices */ | 130 | /* Digianswer devices */ |
159 | { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER }, | 131 | { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER }, |
160 | { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE }, | 132 | { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE }, |
@@ -197,7 +169,10 @@ struct btusb_data { | |||
197 | struct usb_endpoint_descriptor *isoc_tx_ep; | 169 | struct usb_endpoint_descriptor *isoc_tx_ep; |
198 | struct usb_endpoint_descriptor *isoc_rx_ep; | 170 | struct usb_endpoint_descriptor *isoc_rx_ep; |
199 | 171 | ||
172 | __u8 cmdreq_type; | ||
173 | |||
200 | int isoc_altsetting; | 174 | int isoc_altsetting; |
175 | int suspend_count; | ||
201 | }; | 176 | }; |
202 | 177 | ||
203 | static void btusb_intr_complete(struct urb *urb) | 178 | static void btusb_intr_complete(struct urb *urb) |
@@ -236,7 +211,7 @@ static void btusb_intr_complete(struct urb *urb) | |||
236 | } | 211 | } |
237 | } | 212 | } |
238 | 213 | ||
239 | static int btusb_submit_intr_urb(struct hci_dev *hdev) | 214 | static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) |
240 | { | 215 | { |
241 | struct btusb_data *data = hdev->driver_data; | 216 | struct btusb_data *data = hdev->driver_data; |
242 | struct urb *urb; | 217 | struct urb *urb; |
@@ -249,13 +224,13 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev) | |||
249 | if (!data->intr_ep) | 224 | if (!data->intr_ep) |
250 | return -ENODEV; | 225 | return -ENODEV; |
251 | 226 | ||
252 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 227 | urb = usb_alloc_urb(0, mem_flags); |
253 | if (!urb) | 228 | if (!urb) |
254 | return -ENOMEM; | 229 | return -ENOMEM; |
255 | 230 | ||
256 | size = le16_to_cpu(data->intr_ep->wMaxPacketSize); | 231 | size = le16_to_cpu(data->intr_ep->wMaxPacketSize); |
257 | 232 | ||
258 | buf = kmalloc(size, GFP_ATOMIC); | 233 | buf = kmalloc(size, mem_flags); |
259 | if (!buf) { | 234 | if (!buf) { |
260 | usb_free_urb(urb); | 235 | usb_free_urb(urb); |
261 | return -ENOMEM; | 236 | return -ENOMEM; |
@@ -271,7 +246,7 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev) | |||
271 | 246 | ||
272 | usb_anchor_urb(urb, &data->intr_anchor); | 247 | usb_anchor_urb(urb, &data->intr_anchor); |
273 | 248 | ||
274 | err = usb_submit_urb(urb, GFP_ATOMIC); | 249 | err = usb_submit_urb(urb, mem_flags); |
275 | if (err < 0) { | 250 | if (err < 0) { |
276 | BT_ERR("%s urb %p submission failed (%d)", | 251 | BT_ERR("%s urb %p submission failed (%d)", |
277 | hdev->name, urb, -err); | 252 | hdev->name, urb, -err); |
@@ -319,7 +294,7 @@ static void btusb_bulk_complete(struct urb *urb) | |||
319 | } | 294 | } |
320 | } | 295 | } |
321 | 296 | ||
322 | static int btusb_submit_bulk_urb(struct hci_dev *hdev) | 297 | static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags) |
323 | { | 298 | { |
324 | struct btusb_data *data = hdev->driver_data; | 299 | struct btusb_data *data = hdev->driver_data; |
325 | struct urb *urb; | 300 | struct urb *urb; |
@@ -332,13 +307,13 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev) | |||
332 | if (!data->bulk_rx_ep) | 307 | if (!data->bulk_rx_ep) |
333 | return -ENODEV; | 308 | return -ENODEV; |
334 | 309 | ||
335 | urb = usb_alloc_urb(0, GFP_KERNEL); | 310 | urb = usb_alloc_urb(0, mem_flags); |
336 | if (!urb) | 311 | if (!urb) |
337 | return -ENOMEM; | 312 | return -ENOMEM; |
338 | 313 | ||
339 | size = le16_to_cpu(data->bulk_rx_ep->wMaxPacketSize); | 314 | size = le16_to_cpu(data->bulk_rx_ep->wMaxPacketSize); |
340 | 315 | ||
341 | buf = kmalloc(size, GFP_KERNEL); | 316 | buf = kmalloc(size, mem_flags); |
342 | if (!buf) { | 317 | if (!buf) { |
343 | usb_free_urb(urb); | 318 | usb_free_urb(urb); |
344 | return -ENOMEM; | 319 | return -ENOMEM; |
@@ -353,7 +328,7 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev) | |||
353 | 328 | ||
354 | usb_anchor_urb(urb, &data->bulk_anchor); | 329 | usb_anchor_urb(urb, &data->bulk_anchor); |
355 | 330 | ||
356 | err = usb_submit_urb(urb, GFP_KERNEL); | 331 | err = usb_submit_urb(urb, mem_flags); |
357 | if (err < 0) { | 332 | if (err < 0) { |
358 | BT_ERR("%s urb %p submission failed (%d)", | 333 | BT_ERR("%s urb %p submission failed (%d)", |
359 | hdev->name, urb, -err); | 334 | hdev->name, urb, -err); |
@@ -430,7 +405,7 @@ static void inline __fill_isoc_descriptor(struct urb *urb, int len, int mtu) | |||
430 | urb->number_of_packets = i; | 405 | urb->number_of_packets = i; |
431 | } | 406 | } |
432 | 407 | ||
433 | static int btusb_submit_isoc_urb(struct hci_dev *hdev) | 408 | static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags) |
434 | { | 409 | { |
435 | struct btusb_data *data = hdev->driver_data; | 410 | struct btusb_data *data = hdev->driver_data; |
436 | struct urb *urb; | 411 | struct urb *urb; |
@@ -443,14 +418,14 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev) | |||
443 | if (!data->isoc_rx_ep) | 418 | if (!data->isoc_rx_ep) |
444 | return -ENODEV; | 419 | return -ENODEV; |
445 | 420 | ||
446 | urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_KERNEL); | 421 | urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, mem_flags); |
447 | if (!urb) | 422 | if (!urb) |
448 | return -ENOMEM; | 423 | return -ENOMEM; |
449 | 424 | ||
450 | size = le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize) * | 425 | size = le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize) * |
451 | BTUSB_MAX_ISOC_FRAMES; | 426 | BTUSB_MAX_ISOC_FRAMES; |
452 | 427 | ||
453 | buf = kmalloc(size, GFP_KERNEL); | 428 | buf = kmalloc(size, mem_flags); |
454 | if (!buf) { | 429 | if (!buf) { |
455 | usb_free_urb(urb); | 430 | usb_free_urb(urb); |
456 | return -ENOMEM; | 431 | return -ENOMEM; |
@@ -473,7 +448,7 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev) | |||
473 | 448 | ||
474 | usb_anchor_urb(urb, &data->isoc_anchor); | 449 | usb_anchor_urb(urb, &data->isoc_anchor); |
475 | 450 | ||
476 | err = usb_submit_urb(urb, GFP_KERNEL); | 451 | err = usb_submit_urb(urb, mem_flags); |
477 | if (err < 0) { | 452 | if (err < 0) { |
478 | BT_ERR("%s urb %p submission failed (%d)", | 453 | BT_ERR("%s urb %p submission failed (%d)", |
479 | hdev->name, urb, -err); | 454 | hdev->name, urb, -err); |
@@ -520,7 +495,7 @@ static int btusb_open(struct hci_dev *hdev) | |||
520 | if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags)) | 495 | if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags)) |
521 | return 0; | 496 | return 0; |
522 | 497 | ||
523 | err = btusb_submit_intr_urb(hdev); | 498 | err = btusb_submit_intr_urb(hdev, GFP_KERNEL); |
524 | if (err < 0) { | 499 | if (err < 0) { |
525 | clear_bit(BTUSB_INTR_RUNNING, &data->flags); | 500 | clear_bit(BTUSB_INTR_RUNNING, &data->flags); |
526 | clear_bit(HCI_RUNNING, &hdev->flags); | 501 | clear_bit(HCI_RUNNING, &hdev->flags); |
@@ -589,7 +564,7 @@ static int btusb_send_frame(struct sk_buff *skb) | |||
589 | return -ENOMEM; | 564 | return -ENOMEM; |
590 | } | 565 | } |
591 | 566 | ||
592 | dr->bRequestType = USB_TYPE_CLASS; | 567 | dr->bRequestType = data->cmdreq_type; |
593 | dr->bRequest = 0; | 568 | dr->bRequest = 0; |
594 | dr->wIndex = 0; | 569 | dr->wIndex = 0; |
595 | dr->wValue = 0; | 570 | dr->wValue = 0; |
@@ -680,8 +655,19 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt) | |||
680 | 655 | ||
681 | BT_DBG("%s evt %d", hdev->name, evt); | 656 | BT_DBG("%s evt %d", hdev->name, evt); |
682 | 657 | ||
683 | if (evt == HCI_NOTIFY_CONN_ADD || evt == HCI_NOTIFY_CONN_DEL) | 658 | if (hdev->conn_hash.acl_num > 0) { |
684 | schedule_work(&data->work); | 659 | if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) { |
660 | if (btusb_submit_bulk_urb(hdev, GFP_ATOMIC) < 0) | ||
661 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
662 | else | ||
663 | btusb_submit_bulk_urb(hdev, GFP_ATOMIC); | ||
664 | } | ||
665 | } else { | ||
666 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
667 | usb_unlink_anchored_urbs(&data->bulk_anchor); | ||
668 | } | ||
669 | |||
670 | schedule_work(&data->work); | ||
685 | } | 671 | } |
686 | 672 | ||
687 | static int inline __set_isoc_interface(struct hci_dev *hdev, int altsetting) | 673 | static int inline __set_isoc_interface(struct hci_dev *hdev, int altsetting) |
@@ -732,18 +718,6 @@ static void btusb_work(struct work_struct *work) | |||
732 | struct btusb_data *data = container_of(work, struct btusb_data, work); | 718 | struct btusb_data *data = container_of(work, struct btusb_data, work); |
733 | struct hci_dev *hdev = data->hdev; | 719 | struct hci_dev *hdev = data->hdev; |
734 | 720 | ||
735 | if (hdev->conn_hash.acl_num > 0) { | ||
736 | if (!test_and_set_bit(BTUSB_BULK_RUNNING, &data->flags)) { | ||
737 | if (btusb_submit_bulk_urb(hdev) < 0) | ||
738 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
739 | else | ||
740 | btusb_submit_bulk_urb(hdev); | ||
741 | } | ||
742 | } else { | ||
743 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
744 | usb_kill_anchored_urbs(&data->bulk_anchor); | ||
745 | } | ||
746 | |||
747 | if (hdev->conn_hash.sco_num > 0) { | 721 | if (hdev->conn_hash.sco_num > 0) { |
748 | if (data->isoc_altsetting != 2) { | 722 | if (data->isoc_altsetting != 2) { |
749 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | 723 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |
@@ -754,10 +728,10 @@ static void btusb_work(struct work_struct *work) | |||
754 | } | 728 | } |
755 | 729 | ||
756 | if (!test_and_set_bit(BTUSB_ISOC_RUNNING, &data->flags)) { | 730 | if (!test_and_set_bit(BTUSB_ISOC_RUNNING, &data->flags)) { |
757 | if (btusb_submit_isoc_urb(hdev) < 0) | 731 | if (btusb_submit_isoc_urb(hdev, GFP_KERNEL) < 0) |
758 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | 732 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |
759 | else | 733 | else |
760 | btusb_submit_isoc_urb(hdev); | 734 | btusb_submit_isoc_urb(hdev, GFP_KERNEL); |
761 | } | 735 | } |
762 | } else { | 736 | } else { |
763 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | 737 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |
@@ -828,6 +802,8 @@ static int btusb_probe(struct usb_interface *intf, | |||
828 | return -ENODEV; | 802 | return -ENODEV; |
829 | } | 803 | } |
830 | 804 | ||
805 | data->cmdreq_type = USB_TYPE_CLASS; | ||
806 | |||
831 | data->udev = interface_to_usbdev(intf); | 807 | data->udev = interface_to_usbdev(intf); |
832 | data->intf = intf; | 808 | data->intf = intf; |
833 | 809 | ||
@@ -862,11 +838,11 @@ static int btusb_probe(struct usb_interface *intf, | |||
862 | 838 | ||
863 | hdev->owner = THIS_MODULE; | 839 | hdev->owner = THIS_MODULE; |
864 | 840 | ||
865 | /* interface numbers are hardcoded in the spec */ | 841 | /* Interface numbers are hardcoded in the specification */ |
866 | data->isoc = usb_ifnum_to_if(data->udev, 1); | 842 | data->isoc = usb_ifnum_to_if(data->udev, 1); |
867 | 843 | ||
868 | if (reset || id->driver_info & BTUSB_RESET) | 844 | if (!reset) |
869 | set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks); | 845 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); |
870 | 846 | ||
871 | if (force_scofix || id->driver_info & BTUSB_WRONG_SCO_MTU) { | 847 | if (force_scofix || id->driver_info & BTUSB_WRONG_SCO_MTU) { |
872 | if (!disable_scofix) | 848 | if (!disable_scofix) |
@@ -876,9 +852,23 @@ static int btusb_probe(struct usb_interface *intf, | |||
876 | if (id->driver_info & BTUSB_BROKEN_ISOC) | 852 | if (id->driver_info & BTUSB_BROKEN_ISOC) |
877 | data->isoc = NULL; | 853 | data->isoc = NULL; |
878 | 854 | ||
855 | if (id->driver_info & BTUSB_DIGIANSWER) { | ||
856 | data->cmdreq_type = USB_TYPE_VENDOR; | ||
857 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); | ||
858 | } | ||
859 | |||
860 | if (id->driver_info & BTUSB_CSR) { | ||
861 | struct usb_device *udev = data->udev; | ||
862 | |||
863 | /* Old firmware would otherwise execute USB reset */ | ||
864 | if (le16_to_cpu(udev->descriptor.bcdDevice) < 0x117) | ||
865 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); | ||
866 | } | ||
867 | |||
879 | if (id->driver_info & BTUSB_SNIFFER) { | 868 | if (id->driver_info & BTUSB_SNIFFER) { |
880 | struct usb_device *udev = data->udev; | 869 | struct usb_device *udev = data->udev; |
881 | 870 | ||
871 | /* New sniffer firmware has crippled HCI interface */ | ||
882 | if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997) | 872 | if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997) |
883 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); | 873 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); |
884 | 874 | ||
@@ -949,10 +939,71 @@ static void btusb_disconnect(struct usb_interface *intf) | |||
949 | hci_free_dev(hdev); | 939 | hci_free_dev(hdev); |
950 | } | 940 | } |
951 | 941 | ||
942 | static int btusb_suspend(struct usb_interface *intf, pm_message_t message) | ||
943 | { | ||
944 | struct btusb_data *data = usb_get_intfdata(intf); | ||
945 | |||
946 | BT_DBG("intf %p", intf); | ||
947 | |||
948 | if (data->suspend_count++) | ||
949 | return 0; | ||
950 | |||
951 | cancel_work_sync(&data->work); | ||
952 | |||
953 | usb_kill_anchored_urbs(&data->tx_anchor); | ||
954 | |||
955 | usb_kill_anchored_urbs(&data->isoc_anchor); | ||
956 | usb_kill_anchored_urbs(&data->bulk_anchor); | ||
957 | usb_kill_anchored_urbs(&data->intr_anchor); | ||
958 | |||
959 | return 0; | ||
960 | } | ||
961 | |||
962 | static int btusb_resume(struct usb_interface *intf) | ||
963 | { | ||
964 | struct btusb_data *data = usb_get_intfdata(intf); | ||
965 | struct hci_dev *hdev = data->hdev; | ||
966 | int err; | ||
967 | |||
968 | BT_DBG("intf %p", intf); | ||
969 | |||
970 | if (--data->suspend_count) | ||
971 | return 0; | ||
972 | |||
973 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | ||
974 | return 0; | ||
975 | |||
976 | if (test_bit(BTUSB_INTR_RUNNING, &data->flags)) { | ||
977 | err = btusb_submit_intr_urb(hdev, GFP_NOIO); | ||
978 | if (err < 0) { | ||
979 | clear_bit(BTUSB_INTR_RUNNING, &data->flags); | ||
980 | return err; | ||
981 | } | ||
982 | } | ||
983 | |||
984 | if (test_bit(BTUSB_BULK_RUNNING, &data->flags)) { | ||
985 | if (btusb_submit_bulk_urb(hdev, GFP_NOIO) < 0) | ||
986 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | ||
987 | else | ||
988 | btusb_submit_bulk_urb(hdev, GFP_NOIO); | ||
989 | } | ||
990 | |||
991 | if (test_bit(BTUSB_ISOC_RUNNING, &data->flags)) { | ||
992 | if (btusb_submit_isoc_urb(hdev, GFP_NOIO) < 0) | ||
993 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | ||
994 | else | ||
995 | btusb_submit_isoc_urb(hdev, GFP_NOIO); | ||
996 | } | ||
997 | |||
998 | return 0; | ||
999 | } | ||
1000 | |||
952 | static struct usb_driver btusb_driver = { | 1001 | static struct usb_driver btusb_driver = { |
953 | .name = "btusb", | 1002 | .name = "btusb", |
954 | .probe = btusb_probe, | 1003 | .probe = btusb_probe, |
955 | .disconnect = btusb_disconnect, | 1004 | .disconnect = btusb_disconnect, |
1005 | .suspend = btusb_suspend, | ||
1006 | .resume = btusb_resume, | ||
956 | .id_table = btusb_table, | 1007 | .id_table = btusb_table, |
957 | }; | 1008 | }; |
958 | 1009 | ||
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index 7938062c1cc7..894b2cb11ea6 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c | |||
@@ -47,11 +47,6 @@ | |||
47 | 47 | ||
48 | #include "hci_uart.h" | 48 | #include "hci_uart.h" |
49 | 49 | ||
50 | #ifndef CONFIG_BT_HCIUART_DEBUG | ||
51 | #undef BT_DBG | ||
52 | #define BT_DBG( A... ) | ||
53 | #endif | ||
54 | |||
55 | #define VERSION "0.3" | 50 | #define VERSION "0.3" |
56 | 51 | ||
57 | static int txcrc = 1; | 52 | static int txcrc = 1; |
diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c index bfbae14cf93d..b0fafb055996 100644 --- a/drivers/bluetooth/hci_h4.c +++ b/drivers/bluetooth/hci_h4.c | |||
@@ -46,11 +46,6 @@ | |||
46 | 46 | ||
47 | #include "hci_uart.h" | 47 | #include "hci_uart.h" |
48 | 48 | ||
49 | #ifndef CONFIG_BT_HCIUART_DEBUG | ||
50 | #undef BT_DBG | ||
51 | #define BT_DBG( A... ) | ||
52 | #endif | ||
53 | |||
54 | #define VERSION "1.2" | 49 | #define VERSION "1.2" |
55 | 50 | ||
56 | struct h4_struct { | 51 | struct h4_struct { |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 4426bb552bd9..af761dc434f6 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -46,11 +46,6 @@ | |||
46 | 46 | ||
47 | #include "hci_uart.h" | 47 | #include "hci_uart.h" |
48 | 48 | ||
49 | #ifndef CONFIG_BT_HCIUART_DEBUG | ||
50 | #undef BT_DBG | ||
51 | #define BT_DBG( A... ) | ||
52 | #endif | ||
53 | |||
54 | #define VERSION "2.2" | 49 | #define VERSION "2.2" |
55 | 50 | ||
56 | static int reset = 0; | 51 | static int reset = 0; |
@@ -399,8 +394,8 @@ static int hci_uart_register_dev(struct hci_uart *hu) | |||
399 | 394 | ||
400 | hdev->owner = THIS_MODULE; | 395 | hdev->owner = THIS_MODULE; |
401 | 396 | ||
402 | if (reset) | 397 | if (!reset) |
403 | set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks); | 398 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); |
404 | 399 | ||
405 | if (hci_register_dev(hdev) < 0) { | 400 | if (hci_register_dev(hdev) < 0) { |
406 | BT_ERR("Can't register HCI device"); | 401 | BT_ERR("Can't register HCI device"); |
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c deleted file mode 100644 index 3c453924f838..000000000000 --- a/drivers/bluetooth/hci_usb.c +++ /dev/null | |||
@@ -1,1136 +0,0 @@ | |||
1 | /* | ||
2 | HCI USB driver for Linux Bluetooth protocol stack (BlueZ) | ||
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | ||
4 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | ||
5 | |||
6 | Copyright (C) 2003 Maxim Krasnyansky <maxk@qualcomm.com> | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License version 2 as | ||
10 | published by the Free Software Foundation; | ||
11 | |||
12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
13 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | ||
15 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | ||
16 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | ||
17 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
18 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
19 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
20 | |||
21 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | ||
22 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | ||
23 | SOFTWARE IS DISCLAIMED. | ||
24 | */ | ||
25 | |||
26 | /* | ||
27 | * Bluetooth HCI USB driver. | ||
28 | * Based on original USB Bluetooth driver for Linux kernel | ||
29 | * Copyright (c) 2000 Greg Kroah-Hartman <greg@kroah.com> | ||
30 | * Copyright (c) 2000 Mark Douglas Corner <mcorner@umich.edu> | ||
31 | * | ||
32 | */ | ||
33 | |||
34 | #include <linux/module.h> | ||
35 | |||
36 | #include <linux/kernel.h> | ||
37 | #include <linux/init.h> | ||
38 | #include <linux/unistd.h> | ||
39 | #include <linux/types.h> | ||
40 | #include <linux/interrupt.h> | ||
41 | #include <linux/moduleparam.h> | ||
42 | |||
43 | #include <linux/slab.h> | ||
44 | #include <linux/errno.h> | ||
45 | #include <linux/string.h> | ||
46 | #include <linux/skbuff.h> | ||
47 | |||
48 | #include <linux/usb.h> | ||
49 | |||
50 | #include <net/bluetooth/bluetooth.h> | ||
51 | #include <net/bluetooth/hci_core.h> | ||
52 | |||
53 | #include "hci_usb.h" | ||
54 | |||
55 | #ifndef CONFIG_BT_HCIUSB_DEBUG | ||
56 | #undef BT_DBG | ||
57 | #define BT_DBG(D...) | ||
58 | #endif | ||
59 | |||
60 | #ifndef CONFIG_BT_HCIUSB_ZERO_PACKET | ||
61 | #undef URB_ZERO_PACKET | ||
62 | #define URB_ZERO_PACKET 0 | ||
63 | #endif | ||
64 | |||
65 | static int ignore_dga; | ||
66 | static int ignore_csr; | ||
67 | static int ignore_sniffer; | ||
68 | static int disable_scofix; | ||
69 | static int force_scofix; | ||
70 | static int reset; | ||
71 | |||
72 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
73 | static int isoc = 2; | ||
74 | #endif | ||
75 | |||
76 | #define VERSION "2.10" | ||
77 | |||
78 | static struct usb_driver hci_usb_driver; | ||
79 | |||
80 | static struct usb_device_id bluetooth_ids[] = { | ||
81 | /* Generic Bluetooth USB device */ | ||
82 | { USB_DEVICE_INFO(HCI_DEV_CLASS, HCI_DEV_SUBCLASS, HCI_DEV_PROTOCOL) }, | ||
83 | |||
84 | /* AVM BlueFRITZ! USB v2.0 */ | ||
85 | { USB_DEVICE(0x057c, 0x3800) }, | ||
86 | |||
87 | /* Bluetooth Ultraport Module from IBM */ | ||
88 | { USB_DEVICE(0x04bf, 0x030a) }, | ||
89 | |||
90 | /* ALPS Modules with non-standard id */ | ||
91 | { USB_DEVICE(0x044e, 0x3001) }, | ||
92 | { USB_DEVICE(0x044e, 0x3002) }, | ||
93 | |||
94 | /* Ericsson with non-standard id */ | ||
95 | { USB_DEVICE(0x0bdb, 0x1002) }, | ||
96 | |||
97 | /* Canyon CN-BTU1 with HID interfaces */ | ||
98 | { USB_DEVICE(0x0c10, 0x0000), .driver_info = HCI_RESET }, | ||
99 | |||
100 | { } /* Terminating entry */ | ||
101 | }; | ||
102 | |||
103 | MODULE_DEVICE_TABLE (usb, bluetooth_ids); | ||
104 | |||
105 | static struct usb_device_id blacklist_ids[] = { | ||
106 | /* CSR BlueCore devices */ | ||
107 | { USB_DEVICE(0x0a12, 0x0001), .driver_info = HCI_CSR }, | ||
108 | |||
109 | /* Broadcom BCM2033 without firmware */ | ||
110 | { USB_DEVICE(0x0a5c, 0x2033), .driver_info = HCI_IGNORE }, | ||
111 | |||
112 | /* Broadcom BCM2035 */ | ||
113 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
114 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
115 | { USB_DEVICE(0x0a5c, 0x2009), .driver_info = HCI_BCM92035 }, | ||
116 | |||
117 | /* Broadcom BCM2045 */ | ||
118 | { USB_DEVICE(0x0a5c, 0x2039), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
119 | { USB_DEVICE(0x0a5c, 0x2101), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
120 | |||
121 | /* IBM/Lenovo ThinkPad with Broadcom chip */ | ||
122 | { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
123 | { USB_DEVICE(0x0a5c, 0x2110), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
124 | |||
125 | /* Targus ACB10US */ | ||
126 | { USB_DEVICE(0x0a5c, 0x2100), .driver_info = HCI_RESET }, | ||
127 | |||
128 | /* ANYCOM Bluetooth USB-200 and USB-250 */ | ||
129 | { USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET }, | ||
130 | |||
131 | /* HP laptop with Broadcom chip */ | ||
132 | { USB_DEVICE(0x03f0, 0x171d), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
133 | |||
134 | /* Dell laptop with Broadcom chip */ | ||
135 | { USB_DEVICE(0x413c, 0x8126), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
136 | /* Dell Wireless 370 */ | ||
137 | { USB_DEVICE(0x413c, 0x8156), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
138 | /* Dell Wireless 410 */ | ||
139 | { USB_DEVICE(0x413c, 0x8152), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
140 | |||
141 | /* Broadcom 2046 */ | ||
142 | { USB_DEVICE(0x0a5c, 0x2151), .driver_info = HCI_RESET }, | ||
143 | |||
144 | /* Microsoft Wireless Transceiver for Bluetooth 2.0 */ | ||
145 | { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET }, | ||
146 | |||
147 | /* Kensington Bluetooth USB adapter */ | ||
148 | { USB_DEVICE(0x047d, 0x105d), .driver_info = HCI_RESET }, | ||
149 | { USB_DEVICE(0x047d, 0x105e), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
150 | |||
151 | /* ISSC Bluetooth Adapter v3.1 */ | ||
152 | { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET }, | ||
153 | |||
154 | /* RTX Telecom based adapters with buggy SCO support */ | ||
155 | { USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC }, | ||
156 | { USB_DEVICE(0x0400, 0x080a), .driver_info = HCI_BROKEN_ISOC }, | ||
157 | |||
158 | /* CONWISE Technology based adapters with buggy SCO support */ | ||
159 | { USB_DEVICE(0x0e5e, 0x6622), .driver_info = HCI_BROKEN_ISOC }, | ||
160 | |||
161 | /* Belkin F8T012 and F8T013 devices */ | ||
162 | { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
163 | { USB_DEVICE(0x050d, 0x0013), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | ||
164 | |||
165 | /* Digianswer devices */ | ||
166 | { USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER }, | ||
167 | { USB_DEVICE(0x08fd, 0x0002), .driver_info = HCI_IGNORE }, | ||
168 | |||
169 | /* CSR BlueCore Bluetooth Sniffer */ | ||
170 | { USB_DEVICE(0x0a12, 0x0002), .driver_info = HCI_SNIFFER }, | ||
171 | |||
172 | /* Frontline ComProbe Bluetooth Sniffer */ | ||
173 | { USB_DEVICE(0x16d3, 0x0002), .driver_info = HCI_SNIFFER }, | ||
174 | |||
175 | { } /* Terminating entry */ | ||
176 | }; | ||
177 | |||
178 | static struct _urb *_urb_alloc(int isoc, gfp_t gfp) | ||
179 | { | ||
180 | struct _urb *_urb = kmalloc(sizeof(struct _urb) + | ||
181 | sizeof(struct usb_iso_packet_descriptor) * isoc, gfp); | ||
182 | if (_urb) { | ||
183 | memset(_urb, 0, sizeof(*_urb)); | ||
184 | usb_init_urb(&_urb->urb); | ||
185 | } | ||
186 | return _urb; | ||
187 | } | ||
188 | |||
189 | static struct _urb *_urb_dequeue(struct _urb_queue *q) | ||
190 | { | ||
191 | struct _urb *_urb = NULL; | ||
192 | unsigned long flags; | ||
193 | spin_lock_irqsave(&q->lock, flags); | ||
194 | { | ||
195 | struct list_head *head = &q->head; | ||
196 | struct list_head *next = head->next; | ||
197 | if (next != head) { | ||
198 | _urb = list_entry(next, struct _urb, list); | ||
199 | list_del(next); _urb->queue = NULL; | ||
200 | } | ||
201 | } | ||
202 | spin_unlock_irqrestore(&q->lock, flags); | ||
203 | return _urb; | ||
204 | } | ||
205 | |||
206 | static void hci_usb_rx_complete(struct urb *urb); | ||
207 | static void hci_usb_tx_complete(struct urb *urb); | ||
208 | |||
209 | #define __pending_tx(husb, type) (&husb->pending_tx[type-1]) | ||
210 | #define __pending_q(husb, type) (&husb->pending_q[type-1]) | ||
211 | #define __completed_q(husb, type) (&husb->completed_q[type-1]) | ||
212 | #define __transmit_q(husb, type) (&husb->transmit_q[type-1]) | ||
213 | |||
214 | static inline struct _urb *__get_completed(struct hci_usb *husb, int type) | ||
215 | { | ||
216 | return _urb_dequeue(__completed_q(husb, type)); | ||
217 | } | ||
218 | |||
219 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
220 | static void __fill_isoc_desc(struct urb *urb, int len, int mtu) | ||
221 | { | ||
222 | int offset = 0, i; | ||
223 | |||
224 | BT_DBG("len %d mtu %d", len, mtu); | ||
225 | |||
226 | for (i=0; i < HCI_MAX_ISOC_FRAMES && len >= mtu; i++, offset += mtu, len -= mtu) { | ||
227 | urb->iso_frame_desc[i].offset = offset; | ||
228 | urb->iso_frame_desc[i].length = mtu; | ||
229 | BT_DBG("desc %d offset %d len %d", i, offset, mtu); | ||
230 | } | ||
231 | if (len && i < HCI_MAX_ISOC_FRAMES) { | ||
232 | urb->iso_frame_desc[i].offset = offset; | ||
233 | urb->iso_frame_desc[i].length = len; | ||
234 | BT_DBG("desc %d offset %d len %d", i, offset, len); | ||
235 | i++; | ||
236 | } | ||
237 | urb->number_of_packets = i; | ||
238 | } | ||
239 | #endif | ||
240 | |||
241 | static int hci_usb_intr_rx_submit(struct hci_usb *husb) | ||
242 | { | ||
243 | struct _urb *_urb; | ||
244 | struct urb *urb; | ||
245 | int err, pipe, interval, size; | ||
246 | void *buf; | ||
247 | |||
248 | BT_DBG("%s", husb->hdev->name); | ||
249 | |||
250 | size = le16_to_cpu(husb->intr_in_ep->desc.wMaxPacketSize); | ||
251 | |||
252 | buf = kmalloc(size, GFP_ATOMIC); | ||
253 | if (!buf) | ||
254 | return -ENOMEM; | ||
255 | |||
256 | _urb = _urb_alloc(0, GFP_ATOMIC); | ||
257 | if (!_urb) { | ||
258 | kfree(buf); | ||
259 | return -ENOMEM; | ||
260 | } | ||
261 | _urb->type = HCI_EVENT_PKT; | ||
262 | _urb_queue_tail(__pending_q(husb, _urb->type), _urb); | ||
263 | |||
264 | urb = &_urb->urb; | ||
265 | pipe = usb_rcvintpipe(husb->udev, husb->intr_in_ep->desc.bEndpointAddress); | ||
266 | interval = husb->intr_in_ep->desc.bInterval; | ||
267 | usb_fill_int_urb(urb, husb->udev, pipe, buf, size, hci_usb_rx_complete, husb, interval); | ||
268 | |||
269 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
270 | if (err) { | ||
271 | BT_ERR("%s intr rx submit failed urb %p err %d", | ||
272 | husb->hdev->name, urb, err); | ||
273 | _urb_unlink(_urb); | ||
274 | kfree(_urb); | ||
275 | kfree(buf); | ||
276 | } | ||
277 | return err; | ||
278 | } | ||
279 | |||
280 | static int hci_usb_bulk_rx_submit(struct hci_usb *husb) | ||
281 | { | ||
282 | struct _urb *_urb; | ||
283 | struct urb *urb; | ||
284 | int err, pipe, size = HCI_MAX_FRAME_SIZE; | ||
285 | void *buf; | ||
286 | |||
287 | buf = kmalloc(size, GFP_ATOMIC); | ||
288 | if (!buf) | ||
289 | return -ENOMEM; | ||
290 | |||
291 | _urb = _urb_alloc(0, GFP_ATOMIC); | ||
292 | if (!_urb) { | ||
293 | kfree(buf); | ||
294 | return -ENOMEM; | ||
295 | } | ||
296 | _urb->type = HCI_ACLDATA_PKT; | ||
297 | _urb_queue_tail(__pending_q(husb, _urb->type), _urb); | ||
298 | |||
299 | urb = &_urb->urb; | ||
300 | pipe = usb_rcvbulkpipe(husb->udev, husb->bulk_in_ep->desc.bEndpointAddress); | ||
301 | usb_fill_bulk_urb(urb, husb->udev, pipe, buf, size, hci_usb_rx_complete, husb); | ||
302 | urb->transfer_flags = 0; | ||
303 | |||
304 | BT_DBG("%s urb %p", husb->hdev->name, urb); | ||
305 | |||
306 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
307 | if (err) { | ||
308 | BT_ERR("%s bulk rx submit failed urb %p err %d", | ||
309 | husb->hdev->name, urb, err); | ||
310 | _urb_unlink(_urb); | ||
311 | kfree(_urb); | ||
312 | kfree(buf); | ||
313 | } | ||
314 | return err; | ||
315 | } | ||
316 | |||
317 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
318 | static int hci_usb_isoc_rx_submit(struct hci_usb *husb) | ||
319 | { | ||
320 | struct _urb *_urb; | ||
321 | struct urb *urb; | ||
322 | int err, mtu, size; | ||
323 | void *buf; | ||
324 | |||
325 | mtu = le16_to_cpu(husb->isoc_in_ep->desc.wMaxPacketSize); | ||
326 | size = mtu * HCI_MAX_ISOC_FRAMES; | ||
327 | |||
328 | buf = kmalloc(size, GFP_ATOMIC); | ||
329 | if (!buf) | ||
330 | return -ENOMEM; | ||
331 | |||
332 | _urb = _urb_alloc(HCI_MAX_ISOC_FRAMES, GFP_ATOMIC); | ||
333 | if (!_urb) { | ||
334 | kfree(buf); | ||
335 | return -ENOMEM; | ||
336 | } | ||
337 | _urb->type = HCI_SCODATA_PKT; | ||
338 | _urb_queue_tail(__pending_q(husb, _urb->type), _urb); | ||
339 | |||
340 | urb = &_urb->urb; | ||
341 | |||
342 | urb->context = husb; | ||
343 | urb->dev = husb->udev; | ||
344 | urb->pipe = usb_rcvisocpipe(husb->udev, husb->isoc_in_ep->desc.bEndpointAddress); | ||
345 | urb->complete = hci_usb_rx_complete; | ||
346 | |||
347 | urb->interval = husb->isoc_in_ep->desc.bInterval; | ||
348 | |||
349 | urb->transfer_buffer_length = size; | ||
350 | urb->transfer_buffer = buf; | ||
351 | urb->transfer_flags = URB_ISO_ASAP; | ||
352 | |||
353 | __fill_isoc_desc(urb, size, mtu); | ||
354 | |||
355 | BT_DBG("%s urb %p", husb->hdev->name, urb); | ||
356 | |||
357 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
358 | if (err) { | ||
359 | BT_ERR("%s isoc rx submit failed urb %p err %d", | ||
360 | husb->hdev->name, urb, err); | ||
361 | _urb_unlink(_urb); | ||
362 | kfree(_urb); | ||
363 | kfree(buf); | ||
364 | } | ||
365 | return err; | ||
366 | } | ||
367 | #endif | ||
368 | |||
369 | /* Initialize device */ | ||
370 | static int hci_usb_open(struct hci_dev *hdev) | ||
371 | { | ||
372 | struct hci_usb *husb = (struct hci_usb *) hdev->driver_data; | ||
373 | int i, err; | ||
374 | unsigned long flags; | ||
375 | |||
376 | BT_DBG("%s", hdev->name); | ||
377 | |||
378 | if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) | ||
379 | return 0; | ||
380 | |||
381 | write_lock_irqsave(&husb->completion_lock, flags); | ||
382 | |||
383 | err = hci_usb_intr_rx_submit(husb); | ||
384 | if (!err) { | ||
385 | for (i = 0; i < HCI_MAX_BULK_RX; i++) | ||
386 | hci_usb_bulk_rx_submit(husb); | ||
387 | |||
388 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
389 | if (husb->isoc_iface) | ||
390 | for (i = 0; i < HCI_MAX_ISOC_RX; i++) | ||
391 | hci_usb_isoc_rx_submit(husb); | ||
392 | #endif | ||
393 | } else { | ||
394 | clear_bit(HCI_RUNNING, &hdev->flags); | ||
395 | } | ||
396 | |||
397 | write_unlock_irqrestore(&husb->completion_lock, flags); | ||
398 | return err; | ||
399 | } | ||
400 | |||
401 | /* Reset device */ | ||
402 | static int hci_usb_flush(struct hci_dev *hdev) | ||
403 | { | ||
404 | struct hci_usb *husb = (struct hci_usb *) hdev->driver_data; | ||
405 | int i; | ||
406 | |||
407 | BT_DBG("%s", hdev->name); | ||
408 | |||
409 | for (i = 0; i < 4; i++) | ||
410 | skb_queue_purge(&husb->transmit_q[i]); | ||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static void hci_usb_unlink_urbs(struct hci_usb *husb) | ||
415 | { | ||
416 | int i; | ||
417 | |||
418 | BT_DBG("%s", husb->hdev->name); | ||
419 | |||
420 | for (i = 0; i < 4; i++) { | ||
421 | struct _urb *_urb; | ||
422 | struct urb *urb; | ||
423 | |||
424 | /* Kill pending requests */ | ||
425 | while ((_urb = _urb_dequeue(&husb->pending_q[i]))) { | ||
426 | urb = &_urb->urb; | ||
427 | BT_DBG("%s unlinking _urb %p type %d urb %p", | ||
428 | husb->hdev->name, _urb, _urb->type, urb); | ||
429 | usb_kill_urb(urb); | ||
430 | _urb_queue_tail(__completed_q(husb, _urb->type), _urb); | ||
431 | } | ||
432 | |||
433 | /* Release completed requests */ | ||
434 | while ((_urb = _urb_dequeue(&husb->completed_q[i]))) { | ||
435 | urb = &_urb->urb; | ||
436 | BT_DBG("%s freeing _urb %p type %d urb %p", | ||
437 | husb->hdev->name, _urb, _urb->type, urb); | ||
438 | kfree(urb->setup_packet); | ||
439 | kfree(urb->transfer_buffer); | ||
440 | kfree(_urb); | ||
441 | } | ||
442 | } | ||
443 | } | ||
444 | |||
445 | /* Close device */ | ||
446 | static int hci_usb_close(struct hci_dev *hdev) | ||
447 | { | ||
448 | struct hci_usb *husb = (struct hci_usb *) hdev->driver_data; | ||
449 | unsigned long flags; | ||
450 | |||
451 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) | ||
452 | return 0; | ||
453 | |||
454 | BT_DBG("%s", hdev->name); | ||
455 | |||
456 | /* Synchronize with completion handlers */ | ||
457 | write_lock_irqsave(&husb->completion_lock, flags); | ||
458 | write_unlock_irqrestore(&husb->completion_lock, flags); | ||
459 | |||
460 | hci_usb_unlink_urbs(husb); | ||
461 | hci_usb_flush(hdev); | ||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | static int __tx_submit(struct hci_usb *husb, struct _urb *_urb) | ||
466 | { | ||
467 | struct urb *urb = &_urb->urb; | ||
468 | int err; | ||
469 | |||
470 | BT_DBG("%s urb %p type %d", husb->hdev->name, urb, _urb->type); | ||
471 | |||
472 | _urb_queue_tail(__pending_q(husb, _urb->type), _urb); | ||
473 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
474 | if (err) { | ||
475 | BT_ERR("%s tx submit failed urb %p type %d err %d", | ||
476 | husb->hdev->name, urb, _urb->type, err); | ||
477 | _urb_unlink(_urb); | ||
478 | _urb_queue_tail(__completed_q(husb, _urb->type), _urb); | ||
479 | } else | ||
480 | atomic_inc(__pending_tx(husb, _urb->type)); | ||
481 | |||
482 | return err; | ||
483 | } | ||
484 | |||
485 | static inline int hci_usb_send_ctrl(struct hci_usb *husb, struct sk_buff *skb) | ||
486 | { | ||
487 | struct _urb *_urb = __get_completed(husb, bt_cb(skb)->pkt_type); | ||
488 | struct usb_ctrlrequest *dr; | ||
489 | struct urb *urb; | ||
490 | |||
491 | if (!_urb) { | ||
492 | _urb = _urb_alloc(0, GFP_ATOMIC); | ||
493 | if (!_urb) | ||
494 | return -ENOMEM; | ||
495 | _urb->type = bt_cb(skb)->pkt_type; | ||
496 | |||
497 | dr = kmalloc(sizeof(*dr), GFP_ATOMIC); | ||
498 | if (!dr) { | ||
499 | kfree(_urb); | ||
500 | return -ENOMEM; | ||
501 | } | ||
502 | } else | ||
503 | dr = (void *) _urb->urb.setup_packet; | ||
504 | |||
505 | dr->bRequestType = husb->ctrl_req; | ||
506 | dr->bRequest = 0; | ||
507 | dr->wIndex = 0; | ||
508 | dr->wValue = 0; | ||
509 | dr->wLength = __cpu_to_le16(skb->len); | ||
510 | |||
511 | urb = &_urb->urb; | ||
512 | usb_fill_control_urb(urb, husb->udev, usb_sndctrlpipe(husb->udev, 0), | ||
513 | (void *) dr, skb->data, skb->len, hci_usb_tx_complete, husb); | ||
514 | |||
515 | BT_DBG("%s skb %p len %d", husb->hdev->name, skb, skb->len); | ||
516 | |||
517 | _urb->priv = skb; | ||
518 | return __tx_submit(husb, _urb); | ||
519 | } | ||
520 | |||
521 | static inline int hci_usb_send_bulk(struct hci_usb *husb, struct sk_buff *skb) | ||
522 | { | ||
523 | struct _urb *_urb = __get_completed(husb, bt_cb(skb)->pkt_type); | ||
524 | struct urb *urb; | ||
525 | int pipe; | ||
526 | |||
527 | if (!_urb) { | ||
528 | _urb = _urb_alloc(0, GFP_ATOMIC); | ||
529 | if (!_urb) | ||
530 | return -ENOMEM; | ||
531 | _urb->type = bt_cb(skb)->pkt_type; | ||
532 | } | ||
533 | |||
534 | urb = &_urb->urb; | ||
535 | pipe = usb_sndbulkpipe(husb->udev, husb->bulk_out_ep->desc.bEndpointAddress); | ||
536 | usb_fill_bulk_urb(urb, husb->udev, pipe, skb->data, skb->len, | ||
537 | hci_usb_tx_complete, husb); | ||
538 | urb->transfer_flags = URB_ZERO_PACKET; | ||
539 | |||
540 | BT_DBG("%s skb %p len %d", husb->hdev->name, skb, skb->len); | ||
541 | |||
542 | _urb->priv = skb; | ||
543 | return __tx_submit(husb, _urb); | ||
544 | } | ||
545 | |||
546 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
547 | static inline int hci_usb_send_isoc(struct hci_usb *husb, struct sk_buff *skb) | ||
548 | { | ||
549 | struct _urb *_urb = __get_completed(husb, bt_cb(skb)->pkt_type); | ||
550 | struct urb *urb; | ||
551 | |||
552 | if (!_urb) { | ||
553 | _urb = _urb_alloc(HCI_MAX_ISOC_FRAMES, GFP_ATOMIC); | ||
554 | if (!_urb) | ||
555 | return -ENOMEM; | ||
556 | _urb->type = bt_cb(skb)->pkt_type; | ||
557 | } | ||
558 | |||
559 | BT_DBG("%s skb %p len %d", husb->hdev->name, skb, skb->len); | ||
560 | |||
561 | urb = &_urb->urb; | ||
562 | |||
563 | urb->context = husb; | ||
564 | urb->dev = husb->udev; | ||
565 | urb->pipe = usb_sndisocpipe(husb->udev, husb->isoc_out_ep->desc.bEndpointAddress); | ||
566 | urb->complete = hci_usb_tx_complete; | ||
567 | urb->transfer_flags = URB_ISO_ASAP; | ||
568 | |||
569 | urb->interval = husb->isoc_out_ep->desc.bInterval; | ||
570 | |||
571 | urb->transfer_buffer = skb->data; | ||
572 | urb->transfer_buffer_length = skb->len; | ||
573 | |||
574 | __fill_isoc_desc(urb, skb->len, le16_to_cpu(husb->isoc_out_ep->desc.wMaxPacketSize)); | ||
575 | |||
576 | _urb->priv = skb; | ||
577 | return __tx_submit(husb, _urb); | ||
578 | } | ||
579 | #endif | ||
580 | |||
581 | static void hci_usb_tx_process(struct hci_usb *husb) | ||
582 | { | ||
583 | struct sk_buff_head *q; | ||
584 | struct sk_buff *skb; | ||
585 | |||
586 | BT_DBG("%s", husb->hdev->name); | ||
587 | |||
588 | do { | ||
589 | clear_bit(HCI_USB_TX_WAKEUP, &husb->state); | ||
590 | |||
591 | /* Process command queue */ | ||
592 | q = __transmit_q(husb, HCI_COMMAND_PKT); | ||
593 | if (!atomic_read(__pending_tx(husb, HCI_COMMAND_PKT)) && | ||
594 | (skb = skb_dequeue(q))) { | ||
595 | if (hci_usb_send_ctrl(husb, skb) < 0) | ||
596 | skb_queue_head(q, skb); | ||
597 | } | ||
598 | |||
599 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
600 | /* Process SCO queue */ | ||
601 | q = __transmit_q(husb, HCI_SCODATA_PKT); | ||
602 | if (atomic_read(__pending_tx(husb, HCI_SCODATA_PKT)) < HCI_MAX_ISOC_TX && | ||
603 | (skb = skb_dequeue(q))) { | ||
604 | if (hci_usb_send_isoc(husb, skb) < 0) | ||
605 | skb_queue_head(q, skb); | ||
606 | } | ||
607 | #endif | ||
608 | |||
609 | /* Process ACL queue */ | ||
610 | q = __transmit_q(husb, HCI_ACLDATA_PKT); | ||
611 | while (atomic_read(__pending_tx(husb, HCI_ACLDATA_PKT)) < HCI_MAX_BULK_TX && | ||
612 | (skb = skb_dequeue(q))) { | ||
613 | if (hci_usb_send_bulk(husb, skb) < 0) { | ||
614 | skb_queue_head(q, skb); | ||
615 | break; | ||
616 | } | ||
617 | } | ||
618 | } while(test_bit(HCI_USB_TX_WAKEUP, &husb->state)); | ||
619 | } | ||
620 | |||
621 | static inline void hci_usb_tx_wakeup(struct hci_usb *husb) | ||
622 | { | ||
623 | /* Serialize TX queue processing to avoid data reordering */ | ||
624 | if (!test_and_set_bit(HCI_USB_TX_PROCESS, &husb->state)) { | ||
625 | hci_usb_tx_process(husb); | ||
626 | clear_bit(HCI_USB_TX_PROCESS, &husb->state); | ||
627 | } else | ||
628 | set_bit(HCI_USB_TX_WAKEUP, &husb->state); | ||
629 | } | ||
630 | |||
631 | /* Send frames from HCI layer */ | ||
632 | static int hci_usb_send_frame(struct sk_buff *skb) | ||
633 | { | ||
634 | struct hci_dev *hdev = (struct hci_dev *) skb->dev; | ||
635 | struct hci_usb *husb; | ||
636 | |||
637 | if (!hdev) { | ||
638 | BT_ERR("frame for uknown device (hdev=NULL)"); | ||
639 | return -ENODEV; | ||
640 | } | ||
641 | |||
642 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | ||
643 | return -EBUSY; | ||
644 | |||
645 | BT_DBG("%s type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len); | ||
646 | |||
647 | husb = (struct hci_usb *) hdev->driver_data; | ||
648 | |||
649 | switch (bt_cb(skb)->pkt_type) { | ||
650 | case HCI_COMMAND_PKT: | ||
651 | hdev->stat.cmd_tx++; | ||
652 | break; | ||
653 | |||
654 | case HCI_ACLDATA_PKT: | ||
655 | hdev->stat.acl_tx++; | ||
656 | break; | ||
657 | |||
658 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
659 | case HCI_SCODATA_PKT: | ||
660 | hdev->stat.sco_tx++; | ||
661 | break; | ||
662 | #endif | ||
663 | |||
664 | default: | ||
665 | kfree_skb(skb); | ||
666 | return 0; | ||
667 | } | ||
668 | |||
669 | read_lock(&husb->completion_lock); | ||
670 | |||
671 | skb_queue_tail(__transmit_q(husb, bt_cb(skb)->pkt_type), skb); | ||
672 | hci_usb_tx_wakeup(husb); | ||
673 | |||
674 | read_unlock(&husb->completion_lock); | ||
675 | return 0; | ||
676 | } | ||
677 | |||
678 | static void hci_usb_rx_complete(struct urb *urb) | ||
679 | { | ||
680 | struct _urb *_urb = container_of(urb, struct _urb, urb); | ||
681 | struct hci_usb *husb = (void *) urb->context; | ||
682 | struct hci_dev *hdev = husb->hdev; | ||
683 | int err, count = urb->actual_length; | ||
684 | |||
685 | BT_DBG("%s urb %p type %d status %d count %d flags %x", hdev->name, urb, | ||
686 | _urb->type, urb->status, count, urb->transfer_flags); | ||
687 | |||
688 | read_lock(&husb->completion_lock); | ||
689 | |||
690 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | ||
691 | goto unlock; | ||
692 | |||
693 | if (urb->status || !count) | ||
694 | goto resubmit; | ||
695 | |||
696 | if (_urb->type == HCI_SCODATA_PKT) { | ||
697 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
698 | int i; | ||
699 | for (i=0; i < urb->number_of_packets; i++) { | ||
700 | BT_DBG("desc %d status %d offset %d len %d", i, | ||
701 | urb->iso_frame_desc[i].status, | ||
702 | urb->iso_frame_desc[i].offset, | ||
703 | urb->iso_frame_desc[i].actual_length); | ||
704 | |||
705 | if (!urb->iso_frame_desc[i].status) { | ||
706 | husb->hdev->stat.byte_rx += urb->iso_frame_desc[i].actual_length; | ||
707 | hci_recv_fragment(husb->hdev, _urb->type, | ||
708 | urb->transfer_buffer + urb->iso_frame_desc[i].offset, | ||
709 | urb->iso_frame_desc[i].actual_length); | ||
710 | } | ||
711 | } | ||
712 | #else | ||
713 | ; | ||
714 | #endif | ||
715 | } else { | ||
716 | husb->hdev->stat.byte_rx += count; | ||
717 | err = hci_recv_fragment(husb->hdev, _urb->type, urb->transfer_buffer, count); | ||
718 | if (err < 0) { | ||
719 | BT_ERR("%s corrupted packet: type %d count %d", | ||
720 | husb->hdev->name, _urb->type, count); | ||
721 | hdev->stat.err_rx++; | ||
722 | } | ||
723 | } | ||
724 | |||
725 | resubmit: | ||
726 | urb->dev = husb->udev; | ||
727 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
728 | BT_DBG("%s urb %p type %d resubmit status %d", hdev->name, urb, | ||
729 | _urb->type, err); | ||
730 | |||
731 | unlock: | ||
732 | read_unlock(&husb->completion_lock); | ||
733 | } | ||
734 | |||
735 | static void hci_usb_tx_complete(struct urb *urb) | ||
736 | { | ||
737 | struct _urb *_urb = container_of(urb, struct _urb, urb); | ||
738 | struct hci_usb *husb = (void *) urb->context; | ||
739 | struct hci_dev *hdev = husb->hdev; | ||
740 | |||
741 | BT_DBG("%s urb %p status %d flags %x", hdev->name, urb, | ||
742 | urb->status, urb->transfer_flags); | ||
743 | |||
744 | atomic_dec(__pending_tx(husb, _urb->type)); | ||
745 | |||
746 | urb->transfer_buffer = NULL; | ||
747 | kfree_skb((struct sk_buff *) _urb->priv); | ||
748 | |||
749 | if (!test_bit(HCI_RUNNING, &hdev->flags)) | ||
750 | return; | ||
751 | |||
752 | if (!urb->status) | ||
753 | hdev->stat.byte_tx += urb->transfer_buffer_length; | ||
754 | else | ||
755 | hdev->stat.err_tx++; | ||
756 | |||
757 | read_lock(&husb->completion_lock); | ||
758 | |||
759 | _urb_unlink(_urb); | ||
760 | _urb_queue_tail(__completed_q(husb, _urb->type), _urb); | ||
761 | |||
762 | hci_usb_tx_wakeup(husb); | ||
763 | |||
764 | read_unlock(&husb->completion_lock); | ||
765 | } | ||
766 | |||
767 | static void hci_usb_destruct(struct hci_dev *hdev) | ||
768 | { | ||
769 | struct hci_usb *husb = (struct hci_usb *) hdev->driver_data; | ||
770 | |||
771 | BT_DBG("%s", hdev->name); | ||
772 | |||
773 | kfree(husb); | ||
774 | } | ||
775 | |||
776 | static void hci_usb_notify(struct hci_dev *hdev, unsigned int evt) | ||
777 | { | ||
778 | BT_DBG("%s evt %d", hdev->name, evt); | ||
779 | } | ||
780 | |||
781 | static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | ||
782 | { | ||
783 | struct usb_device *udev = interface_to_usbdev(intf); | ||
784 | struct usb_host_endpoint *bulk_out_ep = NULL; | ||
785 | struct usb_host_endpoint *bulk_in_ep = NULL; | ||
786 | struct usb_host_endpoint *intr_in_ep = NULL; | ||
787 | struct usb_host_endpoint *ep; | ||
788 | struct usb_host_interface *uif; | ||
789 | struct usb_interface *isoc_iface; | ||
790 | struct hci_usb *husb; | ||
791 | struct hci_dev *hdev; | ||
792 | int i, e, size, isoc_ifnum, isoc_alts; | ||
793 | |||
794 | BT_DBG("udev %p intf %p", udev, intf); | ||
795 | |||
796 | if (!id->driver_info) { | ||
797 | const struct usb_device_id *match; | ||
798 | match = usb_match_id(intf, blacklist_ids); | ||
799 | if (match) | ||
800 | id = match; | ||
801 | } | ||
802 | |||
803 | if (id->driver_info & HCI_IGNORE) | ||
804 | return -ENODEV; | ||
805 | |||
806 | if (ignore_dga && id->driver_info & HCI_DIGIANSWER) | ||
807 | return -ENODEV; | ||
808 | |||
809 | if (ignore_csr && id->driver_info & HCI_CSR) | ||
810 | return -ENODEV; | ||
811 | |||
812 | if (ignore_sniffer && id->driver_info & HCI_SNIFFER) | ||
813 | return -ENODEV; | ||
814 | |||
815 | if (intf->cur_altsetting->desc.bInterfaceNumber > 0) | ||
816 | return -ENODEV; | ||
817 | |||
818 | /* Find endpoints that we need */ | ||
819 | uif = intf->cur_altsetting; | ||
820 | for (e = 0; e < uif->desc.bNumEndpoints; e++) { | ||
821 | ep = &uif->endpoint[e]; | ||
822 | |||
823 | switch (ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) { | ||
824 | case USB_ENDPOINT_XFER_INT: | ||
825 | if (ep->desc.bEndpointAddress & USB_DIR_IN) | ||
826 | intr_in_ep = ep; | ||
827 | break; | ||
828 | |||
829 | case USB_ENDPOINT_XFER_BULK: | ||
830 | if (ep->desc.bEndpointAddress & USB_DIR_IN) | ||
831 | bulk_in_ep = ep; | ||
832 | else | ||
833 | bulk_out_ep = ep; | ||
834 | break; | ||
835 | } | ||
836 | } | ||
837 | |||
838 | if (!bulk_in_ep || !bulk_out_ep || !intr_in_ep) { | ||
839 | BT_DBG("Bulk endpoints not found"); | ||
840 | goto done; | ||
841 | } | ||
842 | |||
843 | if (!(husb = kzalloc(sizeof(struct hci_usb), GFP_KERNEL))) { | ||
844 | BT_ERR("Can't allocate: control structure"); | ||
845 | goto done; | ||
846 | } | ||
847 | |||
848 | husb->udev = udev; | ||
849 | husb->bulk_out_ep = bulk_out_ep; | ||
850 | husb->bulk_in_ep = bulk_in_ep; | ||
851 | husb->intr_in_ep = intr_in_ep; | ||
852 | |||
853 | if (id->driver_info & HCI_DIGIANSWER) | ||
854 | husb->ctrl_req = USB_TYPE_VENDOR; | ||
855 | else | ||
856 | husb->ctrl_req = USB_TYPE_CLASS; | ||
857 | |||
858 | /* Find isochronous endpoints that we can use */ | ||
859 | size = 0; | ||
860 | isoc_iface = NULL; | ||
861 | isoc_alts = 0; | ||
862 | isoc_ifnum = 1; | ||
863 | |||
864 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
865 | if (isoc && !(id->driver_info & (HCI_BROKEN_ISOC | HCI_SNIFFER))) | ||
866 | isoc_iface = usb_ifnum_to_if(udev, isoc_ifnum); | ||
867 | |||
868 | if (isoc_iface) { | ||
869 | int a; | ||
870 | struct usb_host_endpoint *isoc_out_ep = NULL; | ||
871 | struct usb_host_endpoint *isoc_in_ep = NULL; | ||
872 | |||
873 | for (a = 0; a < isoc_iface->num_altsetting; a++) { | ||
874 | uif = &isoc_iface->altsetting[a]; | ||
875 | for (e = 0; e < uif->desc.bNumEndpoints; e++) { | ||
876 | ep = &uif->endpoint[e]; | ||
877 | |||
878 | switch (ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) { | ||
879 | case USB_ENDPOINT_XFER_ISOC: | ||
880 | if (le16_to_cpu(ep->desc.wMaxPacketSize) < size || | ||
881 | uif->desc.bAlternateSetting != isoc) | ||
882 | break; | ||
883 | size = le16_to_cpu(ep->desc.wMaxPacketSize); | ||
884 | |||
885 | isoc_alts = uif->desc.bAlternateSetting; | ||
886 | |||
887 | if (ep->desc.bEndpointAddress & USB_DIR_IN) | ||
888 | isoc_in_ep = ep; | ||
889 | else | ||
890 | isoc_out_ep = ep; | ||
891 | break; | ||
892 | } | ||
893 | } | ||
894 | } | ||
895 | |||
896 | if (!isoc_in_ep || !isoc_out_ep) | ||
897 | BT_DBG("Isoc endpoints not found"); | ||
898 | else { | ||
899 | BT_DBG("isoc ifnum %d alts %d", isoc_ifnum, isoc_alts); | ||
900 | if (usb_driver_claim_interface(&hci_usb_driver, isoc_iface, husb) != 0) | ||
901 | BT_ERR("Can't claim isoc interface"); | ||
902 | else if (usb_set_interface(udev, isoc_ifnum, isoc_alts)) { | ||
903 | BT_ERR("Can't set isoc interface settings"); | ||
904 | husb->isoc_iface = isoc_iface; | ||
905 | usb_driver_release_interface(&hci_usb_driver, isoc_iface); | ||
906 | husb->isoc_iface = NULL; | ||
907 | } else { | ||
908 | husb->isoc_iface = isoc_iface; | ||
909 | husb->isoc_in_ep = isoc_in_ep; | ||
910 | husb->isoc_out_ep = isoc_out_ep; | ||
911 | } | ||
912 | } | ||
913 | } | ||
914 | #endif | ||
915 | |||
916 | rwlock_init(&husb->completion_lock); | ||
917 | |||
918 | for (i = 0; i < 4; i++) { | ||
919 | skb_queue_head_init(&husb->transmit_q[i]); | ||
920 | _urb_queue_init(&husb->pending_q[i]); | ||
921 | _urb_queue_init(&husb->completed_q[i]); | ||
922 | } | ||
923 | |||
924 | /* Initialize and register HCI device */ | ||
925 | hdev = hci_alloc_dev(); | ||
926 | if (!hdev) { | ||
927 | BT_ERR("Can't allocate HCI device"); | ||
928 | goto probe_error; | ||
929 | } | ||
930 | |||
931 | husb->hdev = hdev; | ||
932 | |||
933 | hdev->type = HCI_USB; | ||
934 | hdev->driver_data = husb; | ||
935 | SET_HCIDEV_DEV(hdev, &intf->dev); | ||
936 | |||
937 | hdev->open = hci_usb_open; | ||
938 | hdev->close = hci_usb_close; | ||
939 | hdev->flush = hci_usb_flush; | ||
940 | hdev->send = hci_usb_send_frame; | ||
941 | hdev->destruct = hci_usb_destruct; | ||
942 | hdev->notify = hci_usb_notify; | ||
943 | |||
944 | hdev->owner = THIS_MODULE; | ||
945 | |||
946 | if (reset || id->driver_info & HCI_RESET) | ||
947 | set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks); | ||
948 | |||
949 | if (force_scofix || id->driver_info & HCI_WRONG_SCO_MTU) { | ||
950 | if (!disable_scofix) | ||
951 | set_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks); | ||
952 | } | ||
953 | |||
954 | if (id->driver_info & HCI_SNIFFER) { | ||
955 | if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997) | ||
956 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); | ||
957 | } | ||
958 | |||
959 | if (id->driver_info & HCI_BCM92035) { | ||
960 | unsigned char cmd[] = { 0x3b, 0xfc, 0x01, 0x00 }; | ||
961 | struct sk_buff *skb; | ||
962 | |||
963 | skb = bt_skb_alloc(sizeof(cmd), GFP_KERNEL); | ||
964 | if (skb) { | ||
965 | memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd)); | ||
966 | skb_queue_tail(&hdev->driver_init, skb); | ||
967 | } | ||
968 | } | ||
969 | |||
970 | if (hci_register_dev(hdev) < 0) { | ||
971 | BT_ERR("Can't register HCI device"); | ||
972 | hci_free_dev(hdev); | ||
973 | goto probe_error; | ||
974 | } | ||
975 | |||
976 | usb_set_intfdata(intf, husb); | ||
977 | return 0; | ||
978 | |||
979 | probe_error: | ||
980 | if (husb->isoc_iface) | ||
981 | usb_driver_release_interface(&hci_usb_driver, husb->isoc_iface); | ||
982 | kfree(husb); | ||
983 | |||
984 | done: | ||
985 | return -EIO; | ||
986 | } | ||
987 | |||
988 | static void hci_usb_disconnect(struct usb_interface *intf) | ||
989 | { | ||
990 | struct hci_usb *husb = usb_get_intfdata(intf); | ||
991 | struct hci_dev *hdev; | ||
992 | |||
993 | if (!husb || intf == husb->isoc_iface) | ||
994 | return; | ||
995 | |||
996 | usb_set_intfdata(intf, NULL); | ||
997 | hdev = husb->hdev; | ||
998 | |||
999 | BT_DBG("%s", hdev->name); | ||
1000 | |||
1001 | hci_usb_close(hdev); | ||
1002 | |||
1003 | if (husb->isoc_iface) | ||
1004 | usb_driver_release_interface(&hci_usb_driver, husb->isoc_iface); | ||
1005 | |||
1006 | if (hci_unregister_dev(hdev) < 0) | ||
1007 | BT_ERR("Can't unregister HCI device %s", hdev->name); | ||
1008 | |||
1009 | hci_free_dev(hdev); | ||
1010 | } | ||
1011 | |||
1012 | static int hci_usb_suspend(struct usb_interface *intf, pm_message_t message) | ||
1013 | { | ||
1014 | struct hci_usb *husb = usb_get_intfdata(intf); | ||
1015 | struct list_head killed; | ||
1016 | unsigned long flags; | ||
1017 | int i; | ||
1018 | |||
1019 | if (!husb || intf == husb->isoc_iface) | ||
1020 | return 0; | ||
1021 | |||
1022 | hci_suspend_dev(husb->hdev); | ||
1023 | |||
1024 | INIT_LIST_HEAD(&killed); | ||
1025 | |||
1026 | for (i = 0; i < 4; i++) { | ||
1027 | struct _urb_queue *q = &husb->pending_q[i]; | ||
1028 | struct _urb *_urb, *_tmp; | ||
1029 | |||
1030 | while ((_urb = _urb_dequeue(q))) { | ||
1031 | /* reset queue since _urb_dequeue sets it to NULL */ | ||
1032 | _urb->queue = q; | ||
1033 | usb_kill_urb(&_urb->urb); | ||
1034 | list_add(&_urb->list, &killed); | ||
1035 | } | ||
1036 | |||
1037 | spin_lock_irqsave(&q->lock, flags); | ||
1038 | |||
1039 | list_for_each_entry_safe(_urb, _tmp, &killed, list) { | ||
1040 | list_move_tail(&_urb->list, &q->head); | ||
1041 | } | ||
1042 | |||
1043 | spin_unlock_irqrestore(&q->lock, flags); | ||
1044 | } | ||
1045 | |||
1046 | return 0; | ||
1047 | } | ||
1048 | |||
1049 | static int hci_usb_resume(struct usb_interface *intf) | ||
1050 | { | ||
1051 | struct hci_usb *husb = usb_get_intfdata(intf); | ||
1052 | unsigned long flags; | ||
1053 | int i, err = 0; | ||
1054 | |||
1055 | if (!husb || intf == husb->isoc_iface) | ||
1056 | return 0; | ||
1057 | |||
1058 | for (i = 0; i < 4; i++) { | ||
1059 | struct _urb_queue *q = &husb->pending_q[i]; | ||
1060 | struct _urb *_urb; | ||
1061 | |||
1062 | spin_lock_irqsave(&q->lock, flags); | ||
1063 | |||
1064 | list_for_each_entry(_urb, &q->head, list) { | ||
1065 | err = usb_submit_urb(&_urb->urb, GFP_ATOMIC); | ||
1066 | if (err) | ||
1067 | break; | ||
1068 | } | ||
1069 | |||
1070 | spin_unlock_irqrestore(&q->lock, flags); | ||
1071 | |||
1072 | if (err) | ||
1073 | return -EIO; | ||
1074 | } | ||
1075 | |||
1076 | hci_resume_dev(husb->hdev); | ||
1077 | |||
1078 | return 0; | ||
1079 | } | ||
1080 | |||
1081 | static struct usb_driver hci_usb_driver = { | ||
1082 | .name = "hci_usb", | ||
1083 | .probe = hci_usb_probe, | ||
1084 | .disconnect = hci_usb_disconnect, | ||
1085 | .suspend = hci_usb_suspend, | ||
1086 | .resume = hci_usb_resume, | ||
1087 | .id_table = bluetooth_ids, | ||
1088 | }; | ||
1089 | |||
1090 | static int __init hci_usb_init(void) | ||
1091 | { | ||
1092 | int err; | ||
1093 | |||
1094 | BT_INFO("HCI USB driver ver %s", VERSION); | ||
1095 | |||
1096 | if ((err = usb_register(&hci_usb_driver)) < 0) | ||
1097 | BT_ERR("Failed to register HCI USB driver"); | ||
1098 | |||
1099 | return err; | ||
1100 | } | ||
1101 | |||
1102 | static void __exit hci_usb_exit(void) | ||
1103 | { | ||
1104 | usb_deregister(&hci_usb_driver); | ||
1105 | } | ||
1106 | |||
1107 | module_init(hci_usb_init); | ||
1108 | module_exit(hci_usb_exit); | ||
1109 | |||
1110 | module_param(ignore_dga, bool, 0644); | ||
1111 | MODULE_PARM_DESC(ignore_dga, "Ignore devices with id 08fd:0001"); | ||
1112 | |||
1113 | module_param(ignore_csr, bool, 0644); | ||
1114 | MODULE_PARM_DESC(ignore_csr, "Ignore devices with id 0a12:0001"); | ||
1115 | |||
1116 | module_param(ignore_sniffer, bool, 0644); | ||
1117 | MODULE_PARM_DESC(ignore_sniffer, "Ignore devices with id 0a12:0002"); | ||
1118 | |||
1119 | module_param(disable_scofix, bool, 0644); | ||
1120 | MODULE_PARM_DESC(disable_scofix, "Disable fixup of wrong SCO buffer size"); | ||
1121 | |||
1122 | module_param(force_scofix, bool, 0644); | ||
1123 | MODULE_PARM_DESC(force_scofix, "Force fixup of wrong SCO buffers size"); | ||
1124 | |||
1125 | module_param(reset, bool, 0644); | ||
1126 | MODULE_PARM_DESC(reset, "Send HCI reset command on initialization"); | ||
1127 | |||
1128 | #ifdef CONFIG_BT_HCIUSB_SCO | ||
1129 | module_param(isoc, int, 0644); | ||
1130 | MODULE_PARM_DESC(isoc, "Set isochronous transfers for SCO over HCI support"); | ||
1131 | #endif | ||
1132 | |||
1133 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); | ||
1134 | MODULE_DESCRIPTION("Bluetooth HCI USB driver ver " VERSION); | ||
1135 | MODULE_VERSION(VERSION); | ||
1136 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/bluetooth/hci_usb.h b/drivers/bluetooth/hci_usb.h deleted file mode 100644 index 8e659914523f..000000000000 --- a/drivers/bluetooth/hci_usb.h +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | /* | ||
2 | HCI USB driver for Linux Bluetooth protocol stack (BlueZ) | ||
3 | Copyright (C) 2000-2001 Qualcomm Incorporated | ||
4 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> | ||
5 | |||
6 | Copyright (C) 2003 Maxim Krasnyansky <maxk@qualcomm.com> | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License version 2 as | ||
10 | published by the Free Software Foundation; | ||
11 | |||
12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
13 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. | ||
15 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY | ||
16 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES | ||
17 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
18 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
19 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
20 | |||
21 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, | ||
22 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS | ||
23 | SOFTWARE IS DISCLAIMED. | ||
24 | */ | ||
25 | |||
26 | /* Class, SubClass, and Protocol codes that describe a Bluetooth device */ | ||
27 | #define HCI_DEV_CLASS 0xe0 /* Wireless class */ | ||
28 | #define HCI_DEV_SUBCLASS 0x01 /* RF subclass */ | ||
29 | #define HCI_DEV_PROTOCOL 0x01 /* Bluetooth programming protocol */ | ||
30 | |||
31 | #define HCI_IGNORE 0x01 | ||
32 | #define HCI_RESET 0x02 | ||
33 | #define HCI_DIGIANSWER 0x04 | ||
34 | #define HCI_CSR 0x08 | ||
35 | #define HCI_SNIFFER 0x10 | ||
36 | #define HCI_BCM92035 0x20 | ||
37 | #define HCI_BROKEN_ISOC 0x40 | ||
38 | #define HCI_WRONG_SCO_MTU 0x80 | ||
39 | |||
40 | #define HCI_MAX_IFACE_NUM 3 | ||
41 | |||
42 | #define HCI_MAX_BULK_TX 4 | ||
43 | #define HCI_MAX_BULK_RX 1 | ||
44 | |||
45 | #define HCI_MAX_ISOC_RX 2 | ||
46 | #define HCI_MAX_ISOC_TX 2 | ||
47 | |||
48 | #define HCI_MAX_ISOC_FRAMES 10 | ||
49 | |||
50 | struct _urb_queue { | ||
51 | struct list_head head; | ||
52 | spinlock_t lock; | ||
53 | }; | ||
54 | |||
55 | struct _urb { | ||
56 | struct list_head list; | ||
57 | struct _urb_queue *queue; | ||
58 | int type; | ||
59 | void *priv; | ||
60 | struct urb urb; | ||
61 | }; | ||
62 | |||
63 | static inline void _urb_queue_init(struct _urb_queue *q) | ||
64 | { | ||
65 | INIT_LIST_HEAD(&q->head); | ||
66 | spin_lock_init(&q->lock); | ||
67 | } | ||
68 | |||
69 | static inline void _urb_queue_head(struct _urb_queue *q, struct _urb *_urb) | ||
70 | { | ||
71 | unsigned long flags; | ||
72 | spin_lock_irqsave(&q->lock, flags); | ||
73 | /* _urb_unlink needs to know which spinlock to use, thus smp_mb(). */ | ||
74 | _urb->queue = q; smp_mb(); list_add(&_urb->list, &q->head); | ||
75 | spin_unlock_irqrestore(&q->lock, flags); | ||
76 | } | ||
77 | |||
78 | static inline void _urb_queue_tail(struct _urb_queue *q, struct _urb *_urb) | ||
79 | { | ||
80 | unsigned long flags; | ||
81 | spin_lock_irqsave(&q->lock, flags); | ||
82 | /* _urb_unlink needs to know which spinlock to use, thus smp_mb(). */ | ||
83 | _urb->queue = q; smp_mb(); list_add_tail(&_urb->list, &q->head); | ||
84 | spin_unlock_irqrestore(&q->lock, flags); | ||
85 | } | ||
86 | |||
87 | static inline void _urb_unlink(struct _urb *_urb) | ||
88 | { | ||
89 | struct _urb_queue *q; | ||
90 | unsigned long flags; | ||
91 | |||
92 | smp_mb(); | ||
93 | q = _urb->queue; | ||
94 | /* If q is NULL, it will die at easy-to-debug NULL pointer dereference. | ||
95 | No need to BUG(). */ | ||
96 | spin_lock_irqsave(&q->lock, flags); | ||
97 | list_del(&_urb->list); _urb->queue = NULL; | ||
98 | spin_unlock_irqrestore(&q->lock, flags); | ||
99 | } | ||
100 | |||
101 | struct hci_usb { | ||
102 | struct hci_dev *hdev; | ||
103 | |||
104 | unsigned long state; | ||
105 | |||
106 | struct usb_device *udev; | ||
107 | |||
108 | struct usb_host_endpoint *bulk_in_ep; | ||
109 | struct usb_host_endpoint *bulk_out_ep; | ||
110 | struct usb_host_endpoint *intr_in_ep; | ||
111 | |||
112 | struct usb_interface *isoc_iface; | ||
113 | struct usb_host_endpoint *isoc_out_ep; | ||
114 | struct usb_host_endpoint *isoc_in_ep; | ||
115 | |||
116 | __u8 ctrl_req; | ||
117 | |||
118 | struct sk_buff_head transmit_q[4]; | ||
119 | |||
120 | rwlock_t completion_lock; | ||
121 | |||
122 | atomic_t pending_tx[4]; /* Number of pending requests */ | ||
123 | struct _urb_queue pending_q[4]; /* Pending requests */ | ||
124 | struct _urb_queue completed_q[4]; /* Completed requests */ | ||
125 | }; | ||
126 | |||
127 | /* States */ | ||
128 | #define HCI_USB_TX_PROCESS 1 | ||
129 | #define HCI_USB_TX_WAKEUP 2 | ||
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 7320a71b6368..0bbefba6469c 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c | |||
@@ -40,11 +40,6 @@ | |||
40 | #include <net/bluetooth/bluetooth.h> | 40 | #include <net/bluetooth/bluetooth.h> |
41 | #include <net/bluetooth/hci_core.h> | 41 | #include <net/bluetooth/hci_core.h> |
42 | 42 | ||
43 | #ifndef CONFIG_BT_HCIVHCI_DEBUG | ||
44 | #undef BT_DBG | ||
45 | #define BT_DBG(D...) | ||
46 | #endif | ||
47 | |||
48 | #define VERSION "1.2" | 43 | #define VERSION "1.2" |
49 | 44 | ||
50 | static int minor = MISC_DYNAMIC_MINOR; | 45 | static int minor = MISC_DYNAMIC_MINOR; |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 996d12df7594..a04f8463ac7e 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -54,8 +54,8 @@ | |||
54 | #define SOL_RFCOMM 18 | 54 | #define SOL_RFCOMM 18 |
55 | 55 | ||
56 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) | 56 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) |
57 | #define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __func__ , ## arg) | 57 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) |
58 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) | 58 | #define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) |
59 | 59 | ||
60 | /* Connection and socket states */ | 60 | /* Connection and socket states */ |
61 | enum { | 61 | enum { |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 3cc294919312..3645139e68c7 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -54,7 +54,7 @@ | |||
54 | 54 | ||
55 | /* HCI device quirks */ | 55 | /* HCI device quirks */ |
56 | enum { | 56 | enum { |
57 | HCI_QUIRK_RESET_ON_INIT, | 57 | HCI_QUIRK_NO_RESET, |
58 | HCI_QUIRK_RAW_DEVICE, | 58 | HCI_QUIRK_RAW_DEVICE, |
59 | HCI_QUIRK_FIXUP_BUFFER_SIZE | 59 | HCI_QUIRK_FIXUP_BUFFER_SIZE |
60 | }; | 60 | }; |
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 8f9431a12c6f..744ed3f07ef3 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -41,18 +41,14 @@ | |||
41 | 41 | ||
42 | #include <net/bluetooth/bluetooth.h> | 42 | #include <net/bluetooth/bluetooth.h> |
43 | 43 | ||
44 | #ifndef CONFIG_BT_SOCK_DEBUG | 44 | #define VERSION "2.14" |
45 | #undef BT_DBG | ||
46 | #define BT_DBG(D...) | ||
47 | #endif | ||
48 | |||
49 | #define VERSION "2.13" | ||
50 | 45 | ||
51 | /* Bluetooth sockets */ | 46 | /* Bluetooth sockets */ |
52 | #define BT_MAX_PROTO 8 | 47 | #define BT_MAX_PROTO 8 |
53 | static struct net_proto_family *bt_proto[BT_MAX_PROTO]; | 48 | static struct net_proto_family *bt_proto[BT_MAX_PROTO]; |
49 | static DEFINE_RWLOCK(bt_proto_lock); | ||
54 | 50 | ||
55 | static struct lock_class_key bt_slock_key[BT_MAX_PROTO]; | 51 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
56 | static struct lock_class_key bt_lock_key[BT_MAX_PROTO]; | 52 | static struct lock_class_key bt_lock_key[BT_MAX_PROTO]; |
57 | static const char *bt_key_strings[BT_MAX_PROTO] = { | 53 | static const char *bt_key_strings[BT_MAX_PROTO] = { |
58 | "sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP", | 54 | "sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP", |
@@ -65,6 +61,7 @@ static const char *bt_key_strings[BT_MAX_PROTO] = { | |||
65 | "sk_lock-AF_BLUETOOTH-BTPROTO_AVDTP", | 61 | "sk_lock-AF_BLUETOOTH-BTPROTO_AVDTP", |
66 | }; | 62 | }; |
67 | 63 | ||
64 | static struct lock_class_key bt_slock_key[BT_MAX_PROTO]; | ||
68 | static const char *bt_slock_key_strings[BT_MAX_PROTO] = { | 65 | static const char *bt_slock_key_strings[BT_MAX_PROTO] = { |
69 | "slock-AF_BLUETOOTH-BTPROTO_L2CAP", | 66 | "slock-AF_BLUETOOTH-BTPROTO_L2CAP", |
70 | "slock-AF_BLUETOOTH-BTPROTO_HCI", | 67 | "slock-AF_BLUETOOTH-BTPROTO_HCI", |
@@ -75,7 +72,25 @@ static const char *bt_slock_key_strings[BT_MAX_PROTO] = { | |||
75 | "slock-AF_BLUETOOTH-BTPROTO_HIDP", | 72 | "slock-AF_BLUETOOTH-BTPROTO_HIDP", |
76 | "slock-AF_BLUETOOTH-BTPROTO_AVDTP", | 73 | "slock-AF_BLUETOOTH-BTPROTO_AVDTP", |
77 | }; | 74 | }; |
78 | static DEFINE_RWLOCK(bt_proto_lock); | 75 | |
76 | static inline void bt_sock_reclassify_lock(struct socket *sock, int proto) | ||
77 | { | ||
78 | struct sock *sk = sock->sk; | ||
79 | |||
80 | if (!sk) | ||
81 | return; | ||
82 | |||
83 | BUG_ON(sock_owned_by_user(sk)); | ||
84 | |||
85 | sock_lock_init_class_and_name(sk, | ||
86 | bt_slock_key_strings[proto], &bt_slock_key[proto], | ||
87 | bt_key_strings[proto], &bt_lock_key[proto]); | ||
88 | } | ||
89 | #else | ||
90 | static inline void bt_sock_reclassify_lock(struct socket *sock, int proto) | ||
91 | { | ||
92 | } | ||
93 | #endif | ||
79 | 94 | ||
80 | int bt_sock_register(int proto, struct net_proto_family *ops) | 95 | int bt_sock_register(int proto, struct net_proto_family *ops) |
81 | { | 96 | { |
@@ -117,21 +132,6 @@ int bt_sock_unregister(int proto) | |||
117 | } | 132 | } |
118 | EXPORT_SYMBOL(bt_sock_unregister); | 133 | EXPORT_SYMBOL(bt_sock_unregister); |
119 | 134 | ||
120 | static void bt_reclassify_sock_lock(struct socket *sock, int proto) | ||
121 | { | ||
122 | struct sock *sk = sock->sk; | ||
123 | |||
124 | if (!sk) | ||
125 | return; | ||
126 | BUG_ON(sock_owned_by_user(sk)); | ||
127 | |||
128 | sock_lock_init_class_and_name(sk, | ||
129 | bt_slock_key_strings[proto], | ||
130 | &bt_slock_key[proto], | ||
131 | bt_key_strings[proto], | ||
132 | &bt_lock_key[proto]); | ||
133 | } | ||
134 | |||
135 | static int bt_sock_create(struct net *net, struct socket *sock, int proto) | 135 | static int bt_sock_create(struct net *net, struct socket *sock, int proto) |
136 | { | 136 | { |
137 | int err; | 137 | int err; |
@@ -151,7 +151,7 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto) | |||
151 | 151 | ||
152 | if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { | 152 | if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { |
153 | err = bt_proto[proto]->create(net, sock, proto); | 153 | err = bt_proto[proto]->create(net, sock, proto); |
154 | bt_reclassify_sock_lock(sock, proto); | 154 | bt_sock_reclassify_lock(sock, proto); |
155 | module_put(bt_proto[proto]->owner); | 155 | module_put(bt_proto[proto]->owner); |
156 | } | 156 | } |
157 | 157 | ||
@@ -240,7 +240,7 @@ int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
240 | size_t copied; | 240 | size_t copied; |
241 | int err; | 241 | int err; |
242 | 242 | ||
243 | BT_DBG("sock %p sk %p len %d", sock, sk, len); | 243 | BT_DBG("sock %p sk %p len %zu", sock, sk, len); |
244 | 244 | ||
245 | if (flags & (MSG_OOB)) | 245 | if (flags & (MSG_OOB)) |
246 | return -EOPNOTSUPP; | 246 | return -EOPNOTSUPP; |
diff --git a/net/bluetooth/bnep/bnep.h b/net/bluetooth/bnep/bnep.h index b69bf4e7c48b..d20f8a40f36e 100644 --- a/net/bluetooth/bnep/bnep.h +++ b/net/bluetooth/bnep/bnep.h | |||
@@ -161,7 +161,7 @@ struct bnep_session { | |||
161 | struct msghdr msg; | 161 | struct msghdr msg; |
162 | 162 | ||
163 | struct bnep_proto_filter proto_filter[BNEP_MAX_PROTO_FILTERS]; | 163 | struct bnep_proto_filter proto_filter[BNEP_MAX_PROTO_FILTERS]; |
164 | u64 mc_filter; | 164 | unsigned long long mc_filter; |
165 | 165 | ||
166 | struct socket *sock; | 166 | struct socket *sock; |
167 | struct net_device *dev; | 167 | struct net_device *dev; |
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index f8efaf35293c..70fea8bdb4e5 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
@@ -52,11 +52,6 @@ | |||
52 | 52 | ||
53 | #include "bnep.h" | 53 | #include "bnep.h" |
54 | 54 | ||
55 | #ifndef CONFIG_BT_BNEP_DEBUG | ||
56 | #undef BT_DBG | ||
57 | #define BT_DBG(D...) | ||
58 | #endif | ||
59 | |||
60 | #define VERSION "1.3" | 55 | #define VERSION "1.3" |
61 | 56 | ||
62 | static int compress_src = 1; | 57 | static int compress_src = 1; |
diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c index 47e179f62e82..f897da6e0444 100644 --- a/net/bluetooth/bnep/netdev.c +++ b/net/bluetooth/bnep/netdev.c | |||
@@ -41,11 +41,6 @@ | |||
41 | 41 | ||
42 | #include "bnep.h" | 42 | #include "bnep.h" |
43 | 43 | ||
44 | #ifndef CONFIG_BT_BNEP_DEBUG | ||
45 | #undef BT_DBG | ||
46 | #define BT_DBG( A... ) | ||
47 | #endif | ||
48 | |||
49 | #define BNEP_TX_QUEUE_LEN 20 | 44 | #define BNEP_TX_QUEUE_LEN 20 |
50 | 45 | ||
51 | static int bnep_net_open(struct net_device *dev) | 46 | static int bnep_net_open(struct net_device *dev) |
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c index 8ffb57f2303a..e857628b0b27 100644 --- a/net/bluetooth/bnep/sock.c +++ b/net/bluetooth/bnep/sock.c | |||
@@ -46,11 +46,6 @@ | |||
46 | 46 | ||
47 | #include "bnep.h" | 47 | #include "bnep.h" |
48 | 48 | ||
49 | #ifndef CONFIG_BT_BNEP_DEBUG | ||
50 | #undef BT_DBG | ||
51 | #define BT_DBG( A... ) | ||
52 | #endif | ||
53 | |||
54 | static int bnep_sock_release(struct socket *sock) | 49 | static int bnep_sock_release(struct socket *sock) |
55 | { | 50 | { |
56 | struct sock *sk = sock->sk; | 51 | struct sock *sk = sock->sk; |
diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c index 3e9d5bb3fefb..78958c0f9a40 100644 --- a/net/bluetooth/cmtp/capi.c +++ b/net/bluetooth/cmtp/capi.c | |||
@@ -42,11 +42,6 @@ | |||
42 | 42 | ||
43 | #include "cmtp.h" | 43 | #include "cmtp.h" |
44 | 44 | ||
45 | #ifndef CONFIG_BT_CMTP_DEBUG | ||
46 | #undef BT_DBG | ||
47 | #define BT_DBG(D...) | ||
48 | #endif | ||
49 | |||
50 | #define CAPI_INTEROPERABILITY 0x20 | 45 | #define CAPI_INTEROPERABILITY 0x20 |
51 | 46 | ||
52 | #define CAPI_INTEROPERABILITY_REQ CAPICMD(CAPI_INTEROPERABILITY, CAPI_REQ) | 47 | #define CAPI_INTEROPERABILITY_REQ CAPICMD(CAPI_INTEROPERABILITY, CAPI_REQ) |
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index ca60a4517fd3..c9cac7719efe 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c | |||
@@ -44,11 +44,6 @@ | |||
44 | 44 | ||
45 | #include "cmtp.h" | 45 | #include "cmtp.h" |
46 | 46 | ||
47 | #ifndef CONFIG_BT_CMTP_DEBUG | ||
48 | #undef BT_DBG | ||
49 | #define BT_DBG(D...) | ||
50 | #endif | ||
51 | |||
52 | #define VERSION "1.0" | 47 | #define VERSION "1.0" |
53 | 48 | ||
54 | static DECLARE_RWSEM(cmtp_session_sem); | 49 | static DECLARE_RWSEM(cmtp_session_sem); |
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c index 8c7f7bc4e0ba..16b0fad74f6e 100644 --- a/net/bluetooth/cmtp/sock.c +++ b/net/bluetooth/cmtp/sock.c | |||
@@ -43,11 +43,6 @@ | |||
43 | 43 | ||
44 | #include "cmtp.h" | 44 | #include "cmtp.h" |
45 | 45 | ||
46 | #ifndef CONFIG_BT_CMTP_DEBUG | ||
47 | #undef BT_DBG | ||
48 | #define BT_DBG(D...) | ||
49 | #endif | ||
50 | |||
51 | static int cmtp_sock_release(struct socket *sock) | 46 | static int cmtp_sock_release(struct socket *sock) |
52 | { | 47 | { |
53 | struct sock *sk = sock->sk; | 48 | struct sock *sk = sock->sk; |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index b7002429f152..a4a789f24c8d 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -45,11 +45,6 @@ | |||
45 | #include <net/bluetooth/bluetooth.h> | 45 | #include <net/bluetooth/bluetooth.h> |
46 | #include <net/bluetooth/hci_core.h> | 46 | #include <net/bluetooth/hci_core.h> |
47 | 47 | ||
48 | #ifndef CONFIG_BT_HCI_CORE_DEBUG | ||
49 | #undef BT_DBG | ||
50 | #define BT_DBG(D...) | ||
51 | #endif | ||
52 | |||
53 | void hci_acl_connect(struct hci_conn *conn) | 48 | void hci_acl_connect(struct hci_conn *conn) |
54 | { | 49 | { |
55 | struct hci_dev *hdev = conn->hdev; | 50 | struct hci_dev *hdev = conn->hdev; |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 278a3ace14f6..ba78cc1eb8d9 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -48,11 +48,6 @@ | |||
48 | #include <net/bluetooth/bluetooth.h> | 48 | #include <net/bluetooth/bluetooth.h> |
49 | #include <net/bluetooth/hci_core.h> | 49 | #include <net/bluetooth/hci_core.h> |
50 | 50 | ||
51 | #ifndef CONFIG_BT_HCI_CORE_DEBUG | ||
52 | #undef BT_DBG | ||
53 | #define BT_DBG(D...) | ||
54 | #endif | ||
55 | |||
56 | static void hci_cmd_task(unsigned long arg); | 51 | static void hci_cmd_task(unsigned long arg); |
57 | static void hci_rx_task(unsigned long arg); | 52 | static void hci_rx_task(unsigned long arg); |
58 | static void hci_tx_task(unsigned long arg); | 53 | static void hci_tx_task(unsigned long arg); |
@@ -205,7 +200,7 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt) | |||
205 | /* Mandatory initialization */ | 200 | /* Mandatory initialization */ |
206 | 201 | ||
207 | /* Reset */ | 202 | /* Reset */ |
208 | if (test_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks)) | 203 | if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) |
209 | hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); | 204 | hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); |
210 | 205 | ||
211 | /* Read Local Supported Features */ | 206 | /* Read Local Supported Features */ |
@@ -290,7 +285,7 @@ static void hci_linkpol_req(struct hci_dev *hdev, unsigned long opt) | |||
290 | { | 285 | { |
291 | __le16 policy = cpu_to_le16(opt); | 286 | __le16 policy = cpu_to_le16(opt); |
292 | 287 | ||
293 | BT_DBG("%s %x", hdev->name, opt); | 288 | BT_DBG("%s %x", hdev->name, policy); |
294 | 289 | ||
295 | /* Default link policy */ | 290 | /* Default link policy */ |
296 | hci_send_cmd(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, 2, &policy); | 291 | hci_send_cmd(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, 2, &policy); |
@@ -756,7 +751,7 @@ int hci_get_dev_list(void __user *arg) | |||
756 | 751 | ||
757 | size = sizeof(*dl) + dev_num * sizeof(*dr); | 752 | size = sizeof(*dl) + dev_num * sizeof(*dr); |
758 | 753 | ||
759 | if (!(dl = kmalloc(size, GFP_KERNEL))) | 754 | if (!(dl = kzalloc(size, GFP_KERNEL))) |
760 | return -ENOMEM; | 755 | return -ENOMEM; |
761 | 756 | ||
762 | dr = dl->dev_req; | 757 | dr = dl->dev_req; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index ad7a553d7713..f91ba690f5d2 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -45,11 +45,6 @@ | |||
45 | #include <net/bluetooth/bluetooth.h> | 45 | #include <net/bluetooth/bluetooth.h> |
46 | #include <net/bluetooth/hci_core.h> | 46 | #include <net/bluetooth/hci_core.h> |
47 | 47 | ||
48 | #ifndef CONFIG_BT_HCI_CORE_DEBUG | ||
49 | #undef BT_DBG | ||
50 | #define BT_DBG(D...) | ||
51 | #endif | ||
52 | |||
53 | /* Handle HCI Event packets */ | 48 | /* Handle HCI Event packets */ |
54 | 49 | ||
55 | static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) | 50 | static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index d62579b67959..4f9621f759a0 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -49,11 +49,6 @@ | |||
49 | #include <net/bluetooth/bluetooth.h> | 49 | #include <net/bluetooth/bluetooth.h> |
50 | #include <net/bluetooth/hci_core.h> | 50 | #include <net/bluetooth/hci_core.h> |
51 | 51 | ||
52 | #ifndef CONFIG_BT_HCI_SOCK_DEBUG | ||
53 | #undef BT_DBG | ||
54 | #define BT_DBG(D...) | ||
55 | #endif | ||
56 | |||
57 | /* ----- HCI socket interface ----- */ | 52 | /* ----- HCI socket interface ----- */ |
58 | 53 | ||
59 | static inline int hci_test_bit(int nr, void *addr) | 54 | static inline int hci_test_bit(int nr, void *addr) |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index f2bbb2f65434..1a1f916be44e 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -6,11 +6,6 @@ | |||
6 | #include <net/bluetooth/bluetooth.h> | 6 | #include <net/bluetooth/bluetooth.h> |
7 | #include <net/bluetooth/hci_core.h> | 7 | #include <net/bluetooth/hci_core.h> |
8 | 8 | ||
9 | #ifndef CONFIG_BT_HCI_CORE_DEBUG | ||
10 | #undef BT_DBG | ||
11 | #define BT_DBG(D...) | ||
12 | #endif | ||
13 | |||
14 | struct class *bt_class = NULL; | 9 | struct class *bt_class = NULL; |
15 | EXPORT_SYMBOL_GPL(bt_class); | 10 | EXPORT_SYMBOL_GPL(bt_class); |
16 | 11 | ||
@@ -420,7 +415,7 @@ int hci_register_sysfs(struct hci_dev *hdev) | |||
420 | dev->class = bt_class; | 415 | dev->class = bt_class; |
421 | dev->parent = hdev->parent; | 416 | dev->parent = hdev->parent; |
422 | 417 | ||
423 | dev_set_name(dev, hdev->name); | 418 | dev_set_name(dev, "%s", hdev->name); |
424 | 419 | ||
425 | dev_set_drvdata(dev, hdev); | 420 | dev_set_drvdata(dev, hdev); |
426 | 421 | ||
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index acdeab3d9807..b18676870d55 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -47,11 +47,6 @@ | |||
47 | 47 | ||
48 | #include "hidp.h" | 48 | #include "hidp.h" |
49 | 49 | ||
50 | #ifndef CONFIG_BT_HIDP_DEBUG | ||
51 | #undef BT_DBG | ||
52 | #define BT_DBG(D...) | ||
53 | #endif | ||
54 | |||
55 | #define VERSION "1.2" | 50 | #define VERSION "1.2" |
56 | 51 | ||
57 | static DECLARE_RWSEM(hidp_session_sem); | 52 | static DECLARE_RWSEM(hidp_session_sem); |
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c index f4dd02ca9a96..37c9d7d2e688 100644 --- a/net/bluetooth/hidp/sock.c +++ b/net/bluetooth/hidp/sock.c | |||
@@ -39,11 +39,6 @@ | |||
39 | 39 | ||
40 | #include "hidp.h" | 40 | #include "hidp.h" |
41 | 41 | ||
42 | #ifndef CONFIG_BT_HIDP_DEBUG | ||
43 | #undef BT_DBG | ||
44 | #define BT_DBG(D...) | ||
45 | #endif | ||
46 | |||
47 | static int hidp_sock_release(struct socket *sock) | 42 | static int hidp_sock_release(struct socket *sock) |
48 | { | 43 | { |
49 | struct sock *sk = sock->sk; | 44 | struct sock *sk = sock->sk; |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 9610a9c85b98..b93748e224ff 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -50,11 +50,6 @@ | |||
50 | #include <net/bluetooth/hci_core.h> | 50 | #include <net/bluetooth/hci_core.h> |
51 | #include <net/bluetooth/l2cap.h> | 51 | #include <net/bluetooth/l2cap.h> |
52 | 52 | ||
53 | #ifndef CONFIG_BT_L2CAP_DEBUG | ||
54 | #undef BT_DBG | ||
55 | #define BT_DBG(D...) | ||
56 | #endif | ||
57 | |||
58 | #define VERSION "2.11" | 53 | #define VERSION "2.11" |
59 | 54 | ||
60 | static u32 l2cap_feat_mask = 0x0000; | 55 | static u32 l2cap_feat_mask = 0x0000; |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index ba537fae0a4c..37c640d1c3fd 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -46,11 +46,6 @@ | |||
46 | #include <net/bluetooth/l2cap.h> | 46 | #include <net/bluetooth/l2cap.h> |
47 | #include <net/bluetooth/rfcomm.h> | 47 | #include <net/bluetooth/rfcomm.h> |
48 | 48 | ||
49 | #ifndef CONFIG_BT_RFCOMM_DEBUG | ||
50 | #undef BT_DBG | ||
51 | #define BT_DBG(D...) | ||
52 | #endif | ||
53 | |||
54 | #define VERSION "1.10" | 49 | #define VERSION "1.10" |
55 | 50 | ||
56 | static int disable_cfc = 0; | 51 | static int disable_cfc = 0; |
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index bc0d4a7ce6ae..ad00cbf449cb 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -50,11 +50,6 @@ | |||
50 | #include <net/bluetooth/l2cap.h> | 50 | #include <net/bluetooth/l2cap.h> |
51 | #include <net/bluetooth/rfcomm.h> | 51 | #include <net/bluetooth/rfcomm.h> |
52 | 52 | ||
53 | #ifndef CONFIG_BT_RFCOMM_DEBUG | ||
54 | #undef BT_DBG | ||
55 | #define BT_DBG(D...) | ||
56 | #endif | ||
57 | |||
58 | static const struct proto_ops rfcomm_sock_ops; | 53 | static const struct proto_ops rfcomm_sock_ops; |
59 | 54 | ||
60 | static struct bt_sock_list rfcomm_sk_list = { | 55 | static struct bt_sock_list rfcomm_sk_list = { |
@@ -644,7 +639,7 @@ static int rfcomm_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
644 | 639 | ||
645 | msg->msg_namelen = 0; | 640 | msg->msg_namelen = 0; |
646 | 641 | ||
647 | BT_DBG("sk %p size %d", sk, size); | 642 | BT_DBG("sk %p size %zu", sk, size); |
648 | 643 | ||
649 | lock_sock(sk); | 644 | lock_sock(sk); |
650 | 645 | ||
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index d3340dd52bcf..111c6c858247 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -39,11 +39,6 @@ | |||
39 | #include <net/bluetooth/hci_core.h> | 39 | #include <net/bluetooth/hci_core.h> |
40 | #include <net/bluetooth/rfcomm.h> | 40 | #include <net/bluetooth/rfcomm.h> |
41 | 41 | ||
42 | #ifndef CONFIG_BT_RFCOMM_DEBUG | ||
43 | #undef BT_DBG | ||
44 | #define BT_DBG(D...) | ||
45 | #endif | ||
46 | |||
47 | #define RFCOMM_TTY_MAGIC 0x6d02 /* magic number for rfcomm struct */ | 42 | #define RFCOMM_TTY_MAGIC 0x6d02 /* magic number for rfcomm struct */ |
48 | #define RFCOMM_TTY_PORTS RFCOMM_MAX_DEV /* whole lotta rfcomm devices */ | 43 | #define RFCOMM_TTY_PORTS RFCOMM_MAX_DEV /* whole lotta rfcomm devices */ |
49 | #define RFCOMM_TTY_MAJOR 216 /* device node major id of the usb/bluetooth.c driver */ | 44 | #define RFCOMM_TTY_MAJOR 216 /* device node major id of the usb/bluetooth.c driver */ |
@@ -58,7 +53,7 @@ struct rfcomm_dev { | |||
58 | char name[12]; | 53 | char name[12]; |
59 | int id; | 54 | int id; |
60 | unsigned long flags; | 55 | unsigned long flags; |
61 | int opened; | 56 | atomic_t opened; |
62 | int err; | 57 | int err; |
63 | 58 | ||
64 | bdaddr_t src; | 59 | bdaddr_t src; |
@@ -261,6 +256,8 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | |||
261 | dev->flags = req->flags & | 256 | dev->flags = req->flags & |
262 | ((1 << RFCOMM_RELEASE_ONHUP) | (1 << RFCOMM_REUSE_DLC)); | 257 | ((1 << RFCOMM_RELEASE_ONHUP) | (1 << RFCOMM_REUSE_DLC)); |
263 | 258 | ||
259 | atomic_set(&dev->opened, 0); | ||
260 | |||
264 | init_waitqueue_head(&dev->wait); | 261 | init_waitqueue_head(&dev->wait); |
265 | tasklet_init(&dev->wakeup_task, rfcomm_tty_wakeup, (unsigned long) dev); | 262 | tasklet_init(&dev->wakeup_task, rfcomm_tty_wakeup, (unsigned long) dev); |
266 | 263 | ||
@@ -330,10 +327,10 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev) | |||
330 | { | 327 | { |
331 | BT_DBG("dev %p", dev); | 328 | BT_DBG("dev %p", dev); |
332 | 329 | ||
333 | if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) | 330 | BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags)); |
334 | BUG_ON(1); | 331 | |
335 | else | 332 | if (atomic_read(&dev->opened) > 0) |
336 | set_bit(RFCOMM_TTY_RELEASED, &dev->flags); | 333 | return; |
337 | 334 | ||
338 | write_lock_bh(&rfcomm_dev_lock); | 335 | write_lock_bh(&rfcomm_dev_lock); |
339 | list_del_init(&dev->list); | 336 | list_del_init(&dev->list); |
@@ -689,9 +686,10 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
689 | if (!dev) | 686 | if (!dev) |
690 | return -ENODEV; | 687 | return -ENODEV; |
691 | 688 | ||
692 | BT_DBG("dev %p dst %s channel %d opened %d", dev, batostr(&dev->dst), dev->channel, dev->opened); | 689 | BT_DBG("dev %p dst %s channel %d opened %d", dev, batostr(&dev->dst), |
690 | dev->channel, atomic_read(&dev->opened)); | ||
693 | 691 | ||
694 | if (dev->opened++ != 0) | 692 | if (atomic_inc_return(&dev->opened) > 1) |
695 | return 0; | 693 | return 0; |
696 | 694 | ||
697 | dlc = dev->dlc; | 695 | dlc = dev->dlc; |
@@ -747,9 +745,10 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
747 | if (!dev) | 745 | if (!dev) |
748 | return; | 746 | return; |
749 | 747 | ||
750 | BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc, dev->opened); | 748 | BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc, |
749 | atomic_read(&dev->opened)); | ||
751 | 750 | ||
752 | if (--dev->opened == 0) { | 751 | if (atomic_dec_and_test(&dev->opened)) { |
753 | if (dev->tty_dev->parent) | 752 | if (dev->tty_dev->parent) |
754 | device_move(dev->tty_dev, NULL); | 753 | device_move(dev->tty_dev, NULL); |
755 | 754 | ||
@@ -763,6 +762,14 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
763 | tty->driver_data = NULL; | 762 | tty->driver_data = NULL; |
764 | dev->tty = NULL; | 763 | dev->tty = NULL; |
765 | rfcomm_dlc_unlock(dev->dlc); | 764 | rfcomm_dlc_unlock(dev->dlc); |
765 | |||
766 | if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) { | ||
767 | write_lock_bh(&rfcomm_dev_lock); | ||
768 | list_del_init(&dev->list); | ||
769 | write_unlock_bh(&rfcomm_dev_lock); | ||
770 | |||
771 | rfcomm_dev_put(dev); | ||
772 | } | ||
766 | } | 773 | } |
767 | 774 | ||
768 | rfcomm_dev_put(dev); | 775 | rfcomm_dev_put(dev); |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 0cc91e6da76d..46fd8bf9a690 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -48,11 +48,6 @@ | |||
48 | #include <net/bluetooth/hci_core.h> | 48 | #include <net/bluetooth/hci_core.h> |
49 | #include <net/bluetooth/sco.h> | 49 | #include <net/bluetooth/sco.h> |
50 | 50 | ||
51 | #ifndef CONFIG_BT_SCO_DEBUG | ||
52 | #undef BT_DBG | ||
53 | #define BT_DBG(D...) | ||
54 | #endif | ||
55 | |||
56 | #define VERSION "0.6" | 51 | #define VERSION "0.6" |
57 | 52 | ||
58 | static int disable_esco = 0; | 53 | static int disable_esco = 0; |