Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 279259
b: refs/heads/master
c: 09fd0de
h: refs/heads/master
i:
  279257: a9399f3
  279255: df54c73
v: v3
  • Loading branch information
Gustavo F. Padovan committed Dec 18, 2011
1 parent 4d554d0 commit 713f4ea
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 103 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: b78752cc71d86998d3b77d873c61d6ffdb7a2142
refs/heads/master: 09fd0de5bd8f8ef3317e5365f92f1a13dcd89aa9
8 changes: 3 additions & 5 deletions trunk/include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct adv_entry {
#define NUM_REASSEMBLY 4
struct hci_dev {
struct list_head list;
spinlock_t lock;
struct mutex lock;
atomic_t refcnt;

char name[8];
Expand Down Expand Up @@ -566,10 +566,8 @@ static inline struct hci_dev *hci_dev_hold(struct hci_dev *d)
return NULL;
}

#define hci_dev_lock(d) spin_lock(&d->lock)
#define hci_dev_unlock(d) spin_unlock(&d->lock)
#define hci_dev_lock_bh(d) spin_lock_bh(&d->lock)
#define hci_dev_unlock_bh(d) spin_unlock_bh(&d->lock)
#define hci_dev_lock(d) mutex_lock(&d->lock)
#define hci_dev_unlock(d) mutex_unlock(&d->lock)

struct hci_dev *hci_dev_get(int index);
struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
Expand Down
12 changes: 6 additions & 6 deletions trunk/net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ int hci_get_conn_list(void __user *arg)

ci = cl->conn_info;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
list_for_each_entry(c, &hdev->conn_hash.list, list) {
bacpy(&(ci + n)->bdaddr, &c->dst);
(ci + n)->handle = c->handle;
Expand All @@ -887,7 +887,7 @@ int hci_get_conn_list(void __user *arg)
if (++n >= req.conn_num)
break;
}
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

cl->dev_id = hdev->id;
cl->conn_num = n;
Expand All @@ -911,7 +911,7 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg)
if (copy_from_user(&req, arg, sizeof(req)))
return -EFAULT;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
conn = hci_conn_hash_lookup_ba(hdev, req.type, &req.bdaddr);
if (conn) {
bacpy(&ci.bdaddr, &conn->dst);
Expand All @@ -921,7 +921,7 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg)
ci.state = conn->state;
ci.link_mode = conn->link_mode;
}
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

if (!conn)
return -ENOENT;
Expand All @@ -937,11 +937,11 @@ int hci_get_auth_info(struct hci_dev *hdev, void __user *arg)
if (copy_from_user(&req, arg, sizeof(req)))
return -EFAULT;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &req.bdaddr);
if (conn)
req.type = conn->auth_type;
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

if (!conn)
return -ENOENT;
Expand Down
38 changes: 19 additions & 19 deletions trunk/net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,14 @@ int hci_inquiry(void __user *arg)
if (!hdev)
return -ENODEV;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX ||
inquiry_cache_empty(hdev) ||
ir.flags & IREQ_CACHE_FLUSH) {
inquiry_cache_flush(hdev);
do_inquiry = 1;
}
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

timeo = ir.length * msecs_to_jiffies(2000);

Expand All @@ -462,9 +462,9 @@ int hci_inquiry(void __user *arg)
goto done;
}

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
ir.num_rsp = inquiry_cache_dump(hdev, max_rsp, buf);
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

BT_DBG("num_rsp %d", ir.num_rsp);

Expand Down Expand Up @@ -541,9 +541,9 @@ int hci_dev_open(__u16 dev)
set_bit(HCI_UP, &hdev->flags);
hci_notify(hdev, HCI_DEV_UP);
if (!test_bit(HCI_SETUP, &hdev->flags)) {
hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
mgmt_powered(hdev, 1);
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);
}
} else {
/* Init failed, cleanup */
Expand Down Expand Up @@ -597,10 +597,10 @@ static int hci_dev_do_close(struct hci_dev *hdev)
if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->flags))
cancel_delayed_work(&hdev->power_off);

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
inquiry_cache_flush(hdev);
hci_conn_hash_flush(hdev);
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

hci_notify(hdev, HCI_DEV_DOWN);

Expand Down Expand Up @@ -636,9 +636,9 @@ static int hci_dev_do_close(struct hci_dev *hdev)
* and no tasks are scheduled. */
hdev->close(hdev);

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
mgmt_powered(hdev, 0);
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

/* Clear flags */
hdev->flags = 0;
Expand Down Expand Up @@ -681,10 +681,10 @@ int hci_dev_reset(__u16 dev)
skb_queue_purge(&hdev->rx_q);
skb_queue_purge(&hdev->cmd_q);

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
inquiry_cache_flush(hdev);
hci_conn_hash_flush(hdev);
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

if (hdev->flush)
hdev->flush(hdev);
Expand Down Expand Up @@ -967,13 +967,13 @@ static void hci_discov_off(struct work_struct *work)

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

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);

hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, sizeof(scan), &scan);

hdev->discov_timeout = 0;

hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);
}

int hci_uuids_clear(struct hci_dev *hdev)
Expand Down Expand Up @@ -1443,7 +1443,7 @@ int hci_register_dev(struct hci_dev *hdev)
list_add_tail(&hdev->list, head);

atomic_set(&hdev->refcnt, 1);
spin_lock_init(&hdev->lock);
mutex_init(&hdev->lock);

hdev->flags = 0;
hdev->dev_flags = 0;
Expand Down Expand Up @@ -1558,9 +1558,9 @@ void hci_unregister_dev(struct hci_dev *hdev)

if (!test_bit(HCI_INIT, &hdev->flags) &&
!test_bit(HCI_SETUP, &hdev->flags)) {
hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
mgmt_index_removed(hdev);
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);
}

/* mgmt_index_removed should take care of emptying the
Expand All @@ -1580,13 +1580,13 @@ void hci_unregister_dev(struct hci_dev *hdev)

destroy_workqueue(hdev->workqueue);

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
hci_blacklist_clear(hdev);
hci_uuids_clear(hdev);
hci_link_keys_clear(hdev);
hci_remote_oob_data_clear(hdev);
hci_adv_entries_clear(hdev);
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

__hci_dev_put(hdev);
}
Expand Down
8 changes: 4 additions & 4 deletions trunk/net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ static int hci_sock_blacklist_add(struct hci_dev *hdev, void __user *arg)
if (copy_from_user(&bdaddr, arg, sizeof(bdaddr)))
return -EFAULT;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);

err = hci_blacklist_add(hdev, &bdaddr);

hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

return err;
}
Expand All @@ -205,11 +205,11 @@ static int hci_sock_blacklist_del(struct hci_dev *hdev, void __user *arg)
if (copy_from_user(&bdaddr, arg, sizeof(bdaddr)))
return -EFAULT;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);

err = hci_blacklist_del(hdev, &bdaddr);

hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

return err;
}
Expand Down
20 changes: 10 additions & 10 deletions trunk/net/bluetooth/hci_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static int inquiry_cache_show(struct seq_file *f, void *p)
struct inquiry_cache *cache = &hdev->inq_cache;
struct inquiry_entry *e;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);

for (e = cache->list; e; e = e->next) {
struct inquiry_data *data = &e->data;
Expand All @@ -415,7 +415,7 @@ static int inquiry_cache_show(struct seq_file *f, void *p)
data->rssi, data->ssp_mode, e->timestamp);
}

hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

return 0;
}
Expand All @@ -437,12 +437,12 @@ static int blacklist_show(struct seq_file *f, void *p)
struct hci_dev *hdev = f->private;
struct bdaddr_list *b;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);

list_for_each_entry(b, &hdev->blacklist, list)
seq_printf(f, "%s\n", batostr(&b->bdaddr));

hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

return 0;
}
Expand Down Expand Up @@ -481,12 +481,12 @@ static int uuids_show(struct seq_file *f, void *p)
struct hci_dev *hdev = f->private;
struct bt_uuid *uuid;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);

list_for_each_entry(uuid, &hdev->uuids, list)
print_bt_uuid(f, uuid->uuid);

hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

return 0;
}
Expand All @@ -507,11 +507,11 @@ static int auto_accept_delay_set(void *data, u64 val)
{
struct hci_dev *hdev = data;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);

hdev->auto_accept_delay = val;

hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

return 0;
}
Expand All @@ -520,11 +520,11 @@ static int auto_accept_delay_get(void *data, u64 *val)
{
struct hci_dev *hdev = data;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);

*val = hdev->auto_accept_delay;

hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,11 +795,11 @@ static struct hci_conn *hidp_get_connection(struct hidp_session *session)
if (!hdev)
return NULL;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);
conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
if (conn)
hci_conn_hold_device(conn);
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);

hci_dev_put(hdev);

Expand Down
4 changes: 2 additions & 2 deletions trunk/net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan)
if (!hdev)
return -EHOSTUNREACH;

hci_dev_lock_bh(hdev);
hci_dev_lock(hdev);

auth_type = l2cap_get_auth_type(chan);

Expand Down Expand Up @@ -1214,7 +1214,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan)
err = 0;

done:
hci_dev_unlock_bh(hdev);
hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
}
Expand Down
Loading

0 comments on commit 713f4ea

Please sign in to comment.