Commit 704278cc authored by John W. Linville's avatar John W. Linville

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth

Conflicts:
	net/bluetooth/hci_core.c
parents d6158a55 53e21fbc
...@@ -91,6 +91,10 @@ static struct usb_device_id ath3k_table[] = { ...@@ -91,6 +91,10 @@ static struct usb_device_id ath3k_table[] = {
{ USB_DEVICE(0x0489, 0xe04e) }, { USB_DEVICE(0x0489, 0xe04e) },
{ USB_DEVICE(0x0489, 0xe056) }, { USB_DEVICE(0x0489, 0xe056) },
{ USB_DEVICE(0x0489, 0xe04d) }, { USB_DEVICE(0x0489, 0xe04d) },
{ USB_DEVICE(0x04c5, 0x1330) },
{ USB_DEVICE(0x13d3, 0x3402) },
{ USB_DEVICE(0x0cf3, 0x3121) },
{ USB_DEVICE(0x0cf3, 0xe003) },
/* Atheros AR5BBU12 with sflash firmware */ /* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE02C) }, { USB_DEVICE(0x0489, 0xE02C) },
...@@ -128,6 +132,10 @@ static struct usb_device_id ath3k_blist_tbl[] = { ...@@ -128,6 +132,10 @@ static struct usb_device_id ath3k_blist_tbl[] = {
{ USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
/* Atheros AR5BBU22 with sflash firmware */ /* Atheros AR5BBU22 with sflash firmware */
{ USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
...@@ -193,24 +201,44 @@ static int ath3k_load_firmware(struct usb_device *udev, ...@@ -193,24 +201,44 @@ static int ath3k_load_firmware(struct usb_device *udev,
static int ath3k_get_state(struct usb_device *udev, unsigned char *state) static int ath3k_get_state(struct usb_device *udev, unsigned char *state)
{ {
int pipe = 0; int ret, pipe = 0;
char *buf;
buf = kmalloc(sizeof(*buf), GFP_KERNEL);
if (!buf)
return -ENOMEM;
pipe = usb_rcvctrlpipe(udev, 0); pipe = usb_rcvctrlpipe(udev, 0);
return usb_control_msg(udev, pipe, ATH3K_GETSTATE, ret = usb_control_msg(udev, pipe, ATH3K_GETSTATE,
USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
state, 0x01, USB_CTRL_SET_TIMEOUT); buf, sizeof(*buf), USB_CTRL_SET_TIMEOUT);
*state = *buf;
kfree(buf);
return ret;
} }
static int ath3k_get_version(struct usb_device *udev, static int ath3k_get_version(struct usb_device *udev,
struct ath3k_version *version) struct ath3k_version *version)
{ {
int pipe = 0; int ret, pipe = 0;
struct ath3k_version *buf;
const int size = sizeof(*buf);
buf = kmalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
pipe = usb_rcvctrlpipe(udev, 0); pipe = usb_rcvctrlpipe(udev, 0);
return usb_control_msg(udev, pipe, ATH3K_GETVERSION, ret = usb_control_msg(udev, pipe, ATH3K_GETVERSION,
USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, version, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
sizeof(struct ath3k_version), buf, size, USB_CTRL_SET_TIMEOUT);
USB_CTRL_SET_TIMEOUT);
memcpy(version, buf, size);
kfree(buf);
return ret;
} }
static int ath3k_load_fwfile(struct usb_device *udev, static int ath3k_load_fwfile(struct usb_device *udev,
......
...@@ -154,6 +154,10 @@ static struct usb_device_id blacklist_table[] = { ...@@ -154,6 +154,10 @@ static struct usb_device_id blacklist_table[] = {
{ USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
{ USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
/* Atheros AR5BBU12 with sflash firmware */ /* Atheros AR5BBU12 with sflash firmware */
{ USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
...@@ -1095,7 +1099,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, ...@@ -1095,7 +1099,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)", BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)",
hdev->name, cmd->opcode, PTR_ERR(skb)); hdev->name, cmd->opcode, PTR_ERR(skb));
return -PTR_ERR(skb); return PTR_ERR(skb);
} }
/* It ensures that the returned event matches the event data read from /* It ensures that the returned event matches the event data read from
...@@ -1147,7 +1151,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) ...@@ -1147,7 +1151,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
BT_ERR("%s sending initial HCI reset command failed (%ld)", BT_ERR("%s sending initial HCI reset command failed (%ld)",
hdev->name, PTR_ERR(skb)); hdev->name, PTR_ERR(skb));
return -PTR_ERR(skb); return PTR_ERR(skb);
} }
kfree_skb(skb); kfree_skb(skb);
...@@ -1161,7 +1165,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) ...@@ -1161,7 +1165,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
BT_ERR("%s reading Intel fw version command failed (%ld)", BT_ERR("%s reading Intel fw version command failed (%ld)",
hdev->name, PTR_ERR(skb)); hdev->name, PTR_ERR(skb));
return -PTR_ERR(skb); return PTR_ERR(skb);
} }
if (skb->len != sizeof(*ver)) { if (skb->len != sizeof(*ver)) {
...@@ -1219,7 +1223,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) ...@@ -1219,7 +1223,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
BT_ERR("%s entering Intel manufacturer mode failed (%ld)", BT_ERR("%s entering Intel manufacturer mode failed (%ld)",
hdev->name, PTR_ERR(skb)); hdev->name, PTR_ERR(skb));
release_firmware(fw); release_firmware(fw);
return -PTR_ERR(skb); return PTR_ERR(skb);
} }
if (skb->data[0]) { if (skb->data[0]) {
...@@ -1276,7 +1280,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) ...@@ -1276,7 +1280,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", BT_ERR("%s exiting Intel manufacturer mode failed (%ld)",
hdev->name, PTR_ERR(skb)); hdev->name, PTR_ERR(skb));
return -PTR_ERR(skb); return PTR_ERR(skb);
} }
kfree_skb(skb); kfree_skb(skb);
...@@ -1292,7 +1296,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) ...@@ -1292,7 +1296,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", BT_ERR("%s exiting Intel manufacturer mode failed (%ld)",
hdev->name, PTR_ERR(skb)); hdev->name, PTR_ERR(skb));
return -PTR_ERR(skb); return PTR_ERR(skb);
} }
kfree_skb(skb); kfree_skb(skb);
...@@ -1310,7 +1314,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) ...@@ -1310,7 +1314,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", BT_ERR("%s exiting Intel manufacturer mode failed (%ld)",
hdev->name, PTR_ERR(skb)); hdev->name, PTR_ERR(skb));
return -PTR_ERR(skb); return PTR_ERR(skb);
} }
kfree_skb(skb); kfree_skb(skb);
......
...@@ -513,7 +513,10 @@ static void hci_init2_req(struct hci_request *req, unsigned long opt) ...@@ -513,7 +513,10 @@ static void hci_init2_req(struct hci_request *req, unsigned long opt)
hci_setup_event_mask(req); hci_setup_event_mask(req);
if (hdev->hci_ver > BLUETOOTH_VER_1_1) /* AVM Berlin (31), aka "BlueFRITZ!", doesn't support the read
* local supported commands HCI command.
*/
if (hdev->manufacturer != 31 && hdev->hci_ver > BLUETOOTH_VER_1_1)
hci_req_add(req, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); hci_req_add(req, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL);
if (lmp_ssp_capable(hdev)) { if (lmp_ssp_capable(hdev)) {
...@@ -2165,10 +2168,6 @@ int hci_register_dev(struct hci_dev *hdev) ...@@ -2165,10 +2168,6 @@ int hci_register_dev(struct hci_dev *hdev)
BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
write_lock(&hci_dev_list_lock);
list_add(&hdev->list, &hci_dev_list);
write_unlock(&hci_dev_list_lock);
hdev->workqueue = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND | hdev->workqueue = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND |
WQ_MEM_RECLAIM, 1, hdev->name); WQ_MEM_RECLAIM, 1, hdev->name);
if (!hdev->workqueue) { if (!hdev->workqueue) {
...@@ -2203,6 +2202,10 @@ int hci_register_dev(struct hci_dev *hdev) ...@@ -2203,6 +2202,10 @@ int hci_register_dev(struct hci_dev *hdev)
if (hdev->dev_type != HCI_AMP) if (hdev->dev_type != HCI_AMP)
set_bit(HCI_AUTO_OFF, &hdev->dev_flags); set_bit(HCI_AUTO_OFF, &hdev->dev_flags);
write_lock(&hci_dev_list_lock);
list_add(&hdev->list, &hci_dev_list);
write_unlock(&hci_dev_list_lock);
hci_notify(hdev, HCI_DEV_REG); hci_notify(hdev, HCI_DEV_REG);
hci_dev_hold(hdev); hci_dev_hold(hdev);
...@@ -2215,9 +2218,6 @@ int hci_register_dev(struct hci_dev *hdev) ...@@ -2215,9 +2218,6 @@ int hci_register_dev(struct hci_dev *hdev)
destroy_workqueue(hdev->req_workqueue); destroy_workqueue(hdev->req_workqueue);
err: err:
ida_simple_remove(&hci_index_ida, hdev->id); ida_simple_remove(&hci_index_ida, hdev->id);
write_lock(&hci_dev_list_lock);
list_del(&hdev->list);
write_unlock(&hci_dev_list_lock);
return error; return error;
} }
...@@ -3399,9 +3399,17 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status) ...@@ -3399,9 +3399,17 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status)
*/ */
if (hdev->sent_cmd) { if (hdev->sent_cmd) {
req_complete = bt_cb(hdev->sent_cmd)->req.complete; req_complete = bt_cb(hdev->sent_cmd)->req.complete;
if (req_complete)
if (req_complete) {
/* We must set the complete callback to NULL to
* avoid calling the callback more than once if
* this function gets called again.
*/
bt_cb(hdev->sent_cmd)->req.complete = NULL;
goto call_complete; goto call_complete;
} }
}
/* Remove all pending commands belonging to this request */ /* Remove all pending commands belonging to this request */
spin_lock_irqsave(&hdev->cmd_q.lock, flags); spin_lock_irqsave(&hdev->cmd_q.lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment