]> git.pld-linux.org Git - packages/kernel.git/blame - linux-2.4.20-rc1-bluetooth-USB.patch
- added -r to depmod to actually check modules instead of rejecting
[packages/kernel.git] / linux-2.4.20-rc1-bluetooth-USB.patch
CommitLineData
c4487f6e 1diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.19/drivers/bluetooth/hci_usb.c linux-2.4.20/drivers/bluetooth/hci_usb.c
2--- linux-2.4.19/drivers/bluetooth/hci_usb.c 2002-08-03 00:39:43.000000000 +0000
3+++ linux-2.4.20/drivers/bluetooth/hci_usb.c 2002-10-29 11:18:38.000000000 +0000
4@@ -28,9 +28,9 @@
5 * Copyright (c) 2000 Greg Kroah-Hartman <greg@kroah.com>
6 * Copyright (c) 2000 Mark Douglas Corner <mcorner@umich.edu>
7 *
8- * $Id$
9+ * $Id$
10 */
11-#define VERSION "2.0"
12+#define VERSION "2.1"
13
14 #include <linux/config.h>
15 #include <linux/module.h>
16@@ -73,7 +73,7 @@
17
18 static struct usb_driver hci_usb_driver;
19
20-static struct usb_device_id usb_bluetooth_ids [] = {
21+static struct usb_device_id bluetooth_ids[] = {
22 /* Generic Bluetooth USB device */
23 { USB_DEVICE_INFO(HCI_DEV_CLASS, HCI_DEV_SUBCLASS, HCI_DEV_PROTOCOL) },
24
25@@ -83,16 +83,23 @@
26 { } /* Terminating entry */
27 };
28
29-MODULE_DEVICE_TABLE (usb, usb_bluetooth_ids);
30+MODULE_DEVICE_TABLE (usb, bluetooth_ids);
31+
32+static struct usb_device_id ignore_ids[] = {
33+ /* Broadcom BCM2033 without firmware */
34+ { USB_DEVICE(0x0a5c, 0x2033) },
35+
36+ { } /* Terminating entry */
37+};
38
39 static void hci_usb_interrupt(struct urb *urb);
40 static void hci_usb_rx_complete(struct urb *urb);
41 static void hci_usb_tx_complete(struct urb *urb);
42
43-static purb_t hci_usb_get_completed(struct hci_usb *husb)
44+static struct urb *hci_usb_get_completed(struct hci_usb *husb)
45 {
46 struct sk_buff *skb;
47- purb_t urb = NULL;
48+ struct urb *urb = NULL;
49
50 skb = skb_dequeue(&husb->completed_q);
51 if (skb) {
52@@ -194,22 +201,26 @@
53 {
54 struct hci_usb *husb = (struct hci_usb *) hdev->driver_data;
55 int i, err;
56- long flags;
57+ unsigned long flags;
58
59 BT_DBG("%s", hdev->name);
60
61 if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
62 return 0;
63
64+ MOD_INC_USE_COUNT;
65+
66 write_lock_irqsave(&husb->completion_lock, flags);
67
68 err = hci_usb_enable_intr(husb);
69 if (!err) {
70 for (i = 0; i < HCI_MAX_BULK_TX; i++)
71 hci_usb_rx_submit(husb, NULL);
72- } else
73+ } else {
74 clear_bit(HCI_RUNNING, &hdev->flags);
75-
76+ MOD_DEC_USE_COUNT;
77+ }
78+
79 write_unlock_irqrestore(&husb->completion_lock, flags);
80 return err;
81 }
82@@ -229,7 +240,7 @@
83 static inline void hci_usb_unlink_urbs(struct hci_usb *husb)
84 {
85 struct sk_buff *skb;
86- purb_t urb;
87+ struct urb *urb;
88
89 BT_DBG("%s", husb->hdev.name);
90
91@@ -247,7 +258,7 @@
92 static int hci_usb_close(struct hci_dev *hdev)
93 {
94 struct hci_usb *husb = (struct hci_usb *) hdev->driver_data;
95- long flags;
96+ unsigned long flags;
97
98 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
99 return 0;
100@@ -261,14 +272,16 @@
101 hci_usb_flush(hdev);
102
103 write_unlock_irqrestore(&husb->completion_lock, flags);
104+
105+ MOD_DEC_USE_COUNT;
106 return 0;
107 }
108
109 static inline int hci_usb_send_ctrl(struct hci_usb *husb, struct sk_buff *skb)
110 {
111 struct hci_usb_scb *scb = (void *) skb->cb;
112- purb_t urb = hci_usb_get_completed(husb);
113- devrequest *dr;
114+ struct urb *urb = hci_usb_get_completed(husb);
115+ struct usb_ctrlrequest *dr;
116 int pipe, err;
117
118 if (!urb && !(urb = usb_alloc_urb(0)))
119@@ -281,11 +294,11 @@
120
121 pipe = usb_sndctrlpipe(husb->udev, 0);
122
123- dr->requesttype = HCI_CTRL_REQ;
124- dr->request = 0;
125- dr->index = 0;
126- dr->value = 0;
127- dr->length = __cpu_to_le16(skb->len);
128+ dr->bRequestType = HCI_CTRL_REQ;
129+ dr->bRequest = 0;
130+ dr->wIndex = 0;
131+ dr->wValue = 0;
132+ dr->wLength = __cpu_to_le16(skb->len);
133
134 FILL_CONTROL_URB(urb, husb->udev, pipe, (void *) dr,
135 skb->data, skb->len, hci_usb_tx_complete, skb);
136@@ -308,7 +321,7 @@
137 static inline int hci_usb_send_bulk(struct hci_usb *husb, struct sk_buff *skb)
138 {
139 struct hci_usb_scb *scb = (void *) skb->cb;
140- purb_t urb = hci_usb_get_completed(husb);
141+ struct urb *urb = hci_usb_get_completed(husb);
142 int pipe, err;
143
144 if (!urb && !(urb = usb_alloc_urb(0)))
145@@ -588,76 +601,9 @@
146
147 husb = (struct hci_usb *) hdev->driver_data;
148 kfree(husb);
149-
150- MOD_DEC_USE_COUNT;
151-}
152-
153-#ifdef CONFIG_BLUEZ_USB_FW_LOAD
154-
155-/* Support for user mode Bluetooth USB firmware loader */
156-
157-#define FW_LOADER "/sbin/bluefw"
158-static int errno;
159-
160-static int hci_usb_fw_exec(void *dev)
161-{
162- char *envp[] = { "HOME=/", "TERM=linux",
163- "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
164- char *argv[] = { FW_LOADER, dev, NULL };
165- int err;
166-
167- err = exec_usermodehelper(FW_LOADER, argv, envp);
168- if (err)
169- BT_ERR("failed to exec %s %s", FW_LOADER, (char *)dev);
170- return err;
171 }
172
173-static int hci_usb_fw_load(struct usb_device *udev)
174-{
175- sigset_t tmpsig;
176- char dev[16];
177- pid_t pid;
178- int result;
179-
180- /* Check if root fs is mounted */
181- if (!current->fs->root) {
182- BT_ERR("root fs not mounted");
183- return -EPERM;
184- }
185-
186- sprintf(dev, "%3.3d/%3.3d", udev->bus->busnum, udev->devnum);
187-
188- pid = kernel_thread(hci_usb_fw_exec, (void *)dev, 0);
189- if (pid < 0) {
190- BT_ERR("fork failed, errno %d\n", -pid);
191- return pid;
192- }
193-
194- /* Block signals, everything but SIGKILL/SIGSTOP */
195- spin_lock_irq(&current->sigmask_lock);
196- tmpsig = current->blocked;
197- siginitsetinv(&current->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP));
198- recalc_sigpending(current);
199- spin_unlock_irq(&current->sigmask_lock);
200-
201- result = waitpid(pid, NULL, __WCLONE);
202-
203- /* Allow signals again */
204- spin_lock_irq(&current->sigmask_lock);
205- current->blocked = tmpsig;
206- recalc_sigpending(current);
207- spin_unlock_irq(&current->sigmask_lock);
208-
209- if (result != pid) {
210- BT_ERR("waitpid failed pid %d errno %d\n", pid, -result);
211- return -result;
212- }
213- return 0;
214-}
215-
216-#endif /* CONFIG_BLUEZ_USB_FW_LOAD */
217-
218-static void * hci_usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
219+static void *hci_usb_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
220 {
221 struct usb_endpoint_descriptor *bulk_out_ep[HCI_MAX_IFACE_NUM];
222 struct usb_endpoint_descriptor *isoc_out_ep[HCI_MAX_IFACE_NUM];
223@@ -673,16 +619,16 @@
224
225 BT_DBG("udev %p ifnum %d", udev, ifnum);
226
227+ iface = &udev->actconfig->interface[0];
228+
229+ /* Check our black list */
230+ if (usb_match_id(udev, iface, ignore_ids))
231+ return NULL;
232+
233 /* Check number of endpoints */
234 if (udev->actconfig->interface[ifnum].altsetting[0].bNumEndpoints < 3)
235 return NULL;
236
237- MOD_INC_USE_COUNT;
238-
239-#ifdef CONFIG_BLUEZ_USB_FW_LOAD
240- hci_usb_fw_load(udev);
241-#endif
242-
243 memset(bulk_out_ep, 0, sizeof(bulk_out_ep));
244 memset(isoc_out_ep, 0, sizeof(isoc_out_ep));
245 memset(bulk_in_ep, 0, sizeof(bulk_in_ep));
246@@ -801,7 +747,6 @@
247 kfree(husb);
248
249 done:
250- MOD_DEC_USE_COUNT;
251 return NULL;
252 }
253
254@@ -828,7 +773,7 @@
255 name: "hci_usb",
256 probe: hci_usb_probe,
257 disconnect: hci_usb_disconnect,
258- id_table: usb_bluetooth_ids,
259+ id_table: bluetooth_ids,
260 };
261
262 int hci_usb_init(void)
263diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.19/drivers/bluetooth/hci_usb.h linux-2.4.20/drivers/bluetooth/hci_usb.h
264--- linux-2.4.19/drivers/bluetooth/hci_usb.h 2002-08-03 00:39:43.000000000 +0000
265+++ linux-2.4.20/drivers/bluetooth/hci_usb.h 2002-10-29 11:18:32.000000000 +0000
266@@ -55,7 +55,7 @@
267
268 __u8 intr_ep;
269 __u8 intr_interval;
270- purb_t intr_urb;
271+ struct urb *intr_urb;
272 struct sk_buff * intr_skb;
273
274 rwlock_t completion_lock;
This page took 0.149146 seconds and 4 git commands to generate.