Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306893
b: refs/heads/master
c: fc50744
h: refs/heads/master
i:
  306891: 03b7373
v: v3
  • Loading branch information
Ulisses Furquim authored and Gustavo Padovan committed May 9, 2012
1 parent c24c231 commit 1f09d5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 519e42b38ee47005aaa2243789cda54161e62dc8
refs/heads/master: fc50744c1e518adfb4ff2eda156f941e20aea36d
16 changes: 10 additions & 6 deletions trunk/net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1738,32 +1738,36 @@ int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
/* Register HCI device */
int hci_register_dev(struct hci_dev *hdev)
{
struct list_head *head = &hci_dev_list, *p;
struct list_head *head, *p;
int i, id, error;

if (!hdev->open || !hdev->close)
return -EINVAL;

write_lock(&hci_dev_list_lock);

/* Do not allow HCI_AMP devices to register at index 0,
* so the index can be used as the AMP controller ID.
*/
id = (hdev->dev_type == HCI_BREDR) ? 0 : 1;

write_lock(&hci_dev_list_lock);
head = &hci_dev_list;

/* Find first available device id */
list_for_each(p, &hci_dev_list) {
if (list_entry(p, struct hci_dev, list)->id != id)
int nid = list_entry(p, struct hci_dev, list)->id;
if (nid > id)
break;
head = p; id++;
if (nid == id)
id++;
head = p;
}

sprintf(hdev->name, "hci%d", id);
hdev->id = id;

BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);

list_add_tail(&hdev->list, head);
list_add(&hdev->list, head);

mutex_init(&hdev->lock);

Expand Down

0 comments on commit 1f09d5f

Please sign in to comment.