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 | |
parent | 6a32e4f9dd9219261f8856f817e6655114cfec2f (diff) | |
parent | 6b441fab28ea1cbbf3da75dcd1e7438e6cba704c (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/padovan/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 | ||||
-rw-r--r-- | include/net/bluetooth/rfcomm.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 2 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 2 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 9 |
7 files changed, 29 insertions, 14 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) { |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index d5eee2093b1e..e2e3ecad1008 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
@@ -211,6 +211,7 @@ struct rfcomm_dlc { | |||
211 | #define RFCOMM_AUTH_ACCEPT 6 | 211 | #define RFCOMM_AUTH_ACCEPT 6 |
212 | #define RFCOMM_AUTH_REJECT 7 | 212 | #define RFCOMM_AUTH_REJECT 7 |
213 | #define RFCOMM_DEFER_SETUP 8 | 213 | #define RFCOMM_DEFER_SETUP 8 |
214 | #define RFCOMM_ENC_DROP 9 | ||
214 | 215 | ||
215 | /* Scheduling flags and events */ | 216 | /* Scheduling flags and events */ |
216 | #define RFCOMM_SCHED_WAKEUP 31 | 217 | #define RFCOMM_SCHED_WAKEUP 31 |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index b84458dcc226..be84ae33ae36 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -613,7 +613,7 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
613 | if (!test_bit(HCI_RAW, &hdev->flags)) { | 613 | if (!test_bit(HCI_RAW, &hdev->flags)) { |
614 | set_bit(HCI_INIT, &hdev->flags); | 614 | set_bit(HCI_INIT, &hdev->flags); |
615 | __hci_request(hdev, hci_reset_req, 0, | 615 | __hci_request(hdev, hci_reset_req, 0, |
616 | msecs_to_jiffies(250)); | 616 | msecs_to_jiffies(HCI_INIT_TIMEOUT)); |
617 | clear_bit(HCI_INIT, &hdev->flags); | 617 | clear_bit(HCI_INIT, &hdev->flags); |
618 | } | 618 | } |
619 | 619 | ||
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 5a94eec06caa..5caff4d47596 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -147,8 +147,6 @@ static int read_index_list(struct sock *sk) | |||
147 | 147 | ||
148 | hci_del_off_timer(d); | 148 | hci_del_off_timer(d); |
149 | 149 | ||
150 | set_bit(HCI_MGMT, &d->flags); | ||
151 | |||
152 | if (test_bit(HCI_SETUP, &d->flags)) | 150 | if (test_bit(HCI_SETUP, &d->flags)) |
153 | continue; | 151 | continue; |
154 | 152 | ||
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 38b618c96de6..4e32e18211f9 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -1802,6 +1802,11 @@ static inline void rfcomm_process_dlcs(struct rfcomm_session *s) | |||
1802 | continue; | 1802 | continue; |
1803 | } | 1803 | } |
1804 | 1804 | ||
1805 | if (test_bit(RFCOMM_ENC_DROP, &d->flags)) { | ||
1806 | __rfcomm_dlc_close(d, ECONNREFUSED); | ||
1807 | continue; | ||
1808 | } | ||
1809 | |||
1805 | if (test_and_clear_bit(RFCOMM_AUTH_ACCEPT, &d->flags)) { | 1810 | if (test_and_clear_bit(RFCOMM_AUTH_ACCEPT, &d->flags)) { |
1806 | rfcomm_dlc_clear_timer(d); | 1811 | rfcomm_dlc_clear_timer(d); |
1807 | if (d->out) { | 1812 | if (d->out) { |
@@ -2077,7 +2082,7 @@ static void rfcomm_security_cfm(struct hci_conn *conn, u8 status, u8 encrypt) | |||
2077 | if (test_and_clear_bit(RFCOMM_SEC_PENDING, &d->flags)) { | 2082 | if (test_and_clear_bit(RFCOMM_SEC_PENDING, &d->flags)) { |
2078 | rfcomm_dlc_clear_timer(d); | 2083 | rfcomm_dlc_clear_timer(d); |
2079 | if (status || encrypt == 0x00) { | 2084 | if (status || encrypt == 0x00) { |
2080 | __rfcomm_dlc_close(d, ECONNREFUSED); | 2085 | set_bit(RFCOMM_ENC_DROP, &d->flags); |
2081 | continue; | 2086 | continue; |
2082 | } | 2087 | } |
2083 | } | 2088 | } |
@@ -2088,7 +2093,7 @@ static void rfcomm_security_cfm(struct hci_conn *conn, u8 status, u8 encrypt) | |||
2088 | rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); | 2093 | rfcomm_dlc_set_timer(d, RFCOMM_AUTH_TIMEOUT); |
2089 | continue; | 2094 | continue; |
2090 | } else if (d->sec_level == BT_SECURITY_HIGH) { | 2095 | } else if (d->sec_level == BT_SECURITY_HIGH) { |
2091 | __rfcomm_dlc_close(d, ECONNREFUSED); | 2096 | set_bit(RFCOMM_ENC_DROP, &d->flags); |
2092 | continue; | 2097 | continue; |
2093 | } | 2098 | } |
2094 | } | 2099 | } |