diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-11-02 15:15:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-02 15:15:51 -0400 |
commit | c125d5e846894043361c0c89c1140be8fd6600b7 (patch) | |
tree | 8c613b696dc65b047ae6660e55abcd0c008be490 /drivers/bluetooth | |
parent | 6a32e4f9dd9219261f8856f817e6655114cfec2f (diff) | |
parent | 6b441fab28ea1cbbf3da75dcd1e7438e6cba704c (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/ath3k.c | 4 | ||||
-rw-r--r-- | drivers/bluetooth/bcm203x.c | 12 | ||||
-rw-r--r-- | drivers/bluetooth/bfusb.c | 13 |
3 files changed, 20 insertions, 9 deletions
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index db7cb8111fbe..106beb194f3c 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -105,7 +105,7 @@ static int ath3k_load_firmware(struct usb_device *udev, | |||
105 | 105 | ||
106 | pipe = usb_sndctrlpipe(udev, 0); | 106 | pipe = usb_sndctrlpipe(udev, 0); |
107 | 107 | ||
108 | send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC); | 108 | send_buf = kmalloc(BULK_SIZE, GFP_KERNEL); |
109 | if (!send_buf) { | 109 | if (!send_buf) { |
110 | BT_ERR("Can't allocate memory chunk for firmware"); | 110 | BT_ERR("Can't allocate memory chunk for firmware"); |
111 | return -ENOMEM; | 111 | return -ENOMEM; |
@@ -176,7 +176,7 @@ static int ath3k_load_fwfile(struct usb_device *udev, | |||
176 | 176 | ||
177 | count = firmware->size; | 177 | count = firmware->size; |
178 | 178 | ||
179 | send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC); | 179 | send_buf = kmalloc(BULK_SIZE, GFP_KERNEL); |
180 | if (!send_buf) { | 180 | if (!send_buf) { |
181 | BT_ERR("Can't allocate memory chunk for firmware"); | 181 | BT_ERR("Can't allocate memory chunk for firmware"); |
182 | return -ENOMEM; | 182 | return -ENOMEM; |
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index 8b1b643a519b..54952ab800b8 100644 --- a/drivers/bluetooth/bcm203x.c +++ b/drivers/bluetooth/bcm203x.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | 26 | ||
27 | #include <linux/atomic.h> | ||
27 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
28 | #include <linux/init.h> | 29 | #include <linux/init.h> |
29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
@@ -65,6 +66,7 @@ struct bcm203x_data { | |||
65 | unsigned long state; | 66 | unsigned long state; |
66 | 67 | ||
67 | struct work_struct work; | 68 | struct work_struct work; |
69 | atomic_t shutdown; | ||
68 | 70 | ||
69 | struct urb *urb; | 71 | struct urb *urb; |
70 | unsigned char *buffer; | 72 | unsigned char *buffer; |
@@ -97,6 +99,7 @@ static void bcm203x_complete(struct urb *urb) | |||
97 | 99 | ||
98 | data->state = BCM203X_SELECT_MEMORY; | 100 | data->state = BCM203X_SELECT_MEMORY; |
99 | 101 | ||
102 | /* use workqueue to have a small delay */ | ||
100 | schedule_work(&data->work); | 103 | schedule_work(&data->work); |
101 | break; | 104 | break; |
102 | 105 | ||
@@ -155,7 +158,10 @@ static void bcm203x_work(struct work_struct *work) | |||
155 | struct bcm203x_data *data = | 158 | struct bcm203x_data *data = |
156 | container_of(work, struct bcm203x_data, work); | 159 | container_of(work, struct bcm203x_data, work); |
157 | 160 | ||
158 | if (usb_submit_urb(data->urb, GFP_ATOMIC) < 0) | 161 | if (atomic_read(&data->shutdown)) |
162 | return; | ||
163 | |||
164 | if (usb_submit_urb(data->urb, GFP_KERNEL) < 0) | ||
159 | BT_ERR("Can't submit URB"); | 165 | BT_ERR("Can't submit URB"); |
160 | } | 166 | } |
161 | 167 | ||
@@ -243,6 +249,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
243 | 249 | ||
244 | usb_set_intfdata(intf, data); | 250 | usb_set_intfdata(intf, data); |
245 | 251 | ||
252 | /* use workqueue to have a small delay */ | ||
246 | schedule_work(&data->work); | 253 | schedule_work(&data->work); |
247 | 254 | ||
248 | return 0; | 255 | return 0; |
@@ -254,6 +261,9 @@ static void bcm203x_disconnect(struct usb_interface *intf) | |||
254 | 261 | ||
255 | BT_DBG("intf %p", intf); | 262 | BT_DBG("intf %p", intf); |
256 | 263 | ||
264 | atomic_inc(&data->shutdown); | ||
265 | cancel_work_sync(&data->work); | ||
266 | |||
257 | usb_kill_urb(data->urb); | 267 | usb_kill_urb(data->urb); |
258 | 268 | ||
259 | usb_set_intfdata(intf, NULL); | 269 | usb_set_intfdata(intf, NULL); |
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 005919ab043c..61b591470a90 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c | |||
@@ -568,22 +568,23 @@ static int bfusb_load_firmware(struct bfusb_data *data, | |||
568 | 568 | ||
569 | BT_INFO("BlueFRITZ! USB loading firmware"); | 569 | BT_INFO("BlueFRITZ! USB loading firmware"); |
570 | 570 | ||
571 | buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_KERNEL); | ||
572 | if (!buf) { | ||
573 | BT_ERR("Can't allocate memory chunk for firmware"); | ||
574 | return -ENOMEM; | ||
575 | } | ||
576 | |||
571 | pipe = usb_sndctrlpipe(data->udev, 0); | 577 | pipe = usb_sndctrlpipe(data->udev, 0); |
572 | 578 | ||
573 | if (usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION, | 579 | if (usb_control_msg(data->udev, pipe, USB_REQ_SET_CONFIGURATION, |
574 | 0, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT) < 0) { | 580 | 0, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT) < 0) { |
575 | BT_ERR("Can't change to loading configuration"); | 581 | BT_ERR("Can't change to loading configuration"); |
582 | kfree(buf); | ||
576 | return -EBUSY; | 583 | return -EBUSY; |
577 | } | 584 | } |
578 | 585 | ||
579 | data->udev->toggle[0] = data->udev->toggle[1] = 0; | 586 | data->udev->toggle[0] = data->udev->toggle[1] = 0; |
580 | 587 | ||
581 | buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC); | ||
582 | if (!buf) { | ||
583 | BT_ERR("Can't allocate memory chunk for firmware"); | ||
584 | return -ENOMEM; | ||
585 | } | ||
586 | |||
587 | pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep); | 588 | pipe = usb_sndbulkpipe(data->udev, data->bulk_out_ep); |
588 | 589 | ||
589 | while (count) { | 590 | while (count) { |