diff options
-rw-r--r-- | include/net/bluetooth/hci_core.h | 8 | ||||
-rw-r--r-- | net/bluetooth/hci_conn.c | 12 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 38 | ||||
-rw-r--r-- | net/bluetooth/hci_sock.c | 8 | ||||
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 20 | ||||
-rw-r--r-- | net/bluetooth/hidp/core.c | 4 | ||||
-rw-r--r-- | net/bluetooth/l2cap_core.c | 4 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 104 | ||||
-rw-r--r-- | net/bluetooth/sco.c | 4 |
9 files changed, 100 insertions, 102 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 1e28be45c4f2..e7dbe597a4bb 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -117,7 +117,7 @@ struct adv_entry { | |||
117 | #define NUM_REASSEMBLY 4 | 117 | #define NUM_REASSEMBLY 4 |
118 | struct hci_dev { | 118 | struct hci_dev { |
119 | struct list_head list; | 119 | struct list_head list; |
120 | spinlock_t lock; | 120 | struct mutex lock; |
121 | atomic_t refcnt; | 121 | atomic_t refcnt; |
122 | 122 | ||
123 | char name[8]; | 123 | char name[8]; |
@@ -566,10 +566,8 @@ static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) | |||
566 | return NULL; | 566 | return NULL; |
567 | } | 567 | } |
568 | 568 | ||
569 | #define hci_dev_lock(d) spin_lock(&d->lock) | 569 | #define hci_dev_lock(d) mutex_lock(&d->lock) |
570 | #define hci_dev_unlock(d) spin_unlock(&d->lock) | 570 | #define hci_dev_unlock(d) mutex_unlock(&d->lock) |
571 | #define hci_dev_lock_bh(d) spin_lock_bh(&d->lock) | ||
572 | #define hci_dev_unlock_bh(d) spin_unlock_bh(&d->lock) | ||
573 | 571 | ||
574 | struct hci_dev *hci_dev_get(int index); | 572 | struct hci_dev *hci_dev_get(int index); |
575 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); | 573 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 3131a99dd5f6..d45783de5e2a 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -876,7 +876,7 @@ int hci_get_conn_list(void __user *arg) | |||
876 | 876 | ||
877 | ci = cl->conn_info; | 877 | ci = cl->conn_info; |
878 | 878 | ||
879 | hci_dev_lock_bh(hdev); | 879 | hci_dev_lock(hdev); |
880 | list_for_each_entry(c, &hdev->conn_hash.list, list) { | 880 | list_for_each_entry(c, &hdev->conn_hash.list, list) { |
881 | bacpy(&(ci + n)->bdaddr, &c->dst); | 881 | bacpy(&(ci + n)->bdaddr, &c->dst); |
882 | (ci + n)->handle = c->handle; | 882 | (ci + n)->handle = c->handle; |
@@ -887,7 +887,7 @@ int hci_get_conn_list(void __user *arg) | |||
887 | if (++n >= req.conn_num) | 887 | if (++n >= req.conn_num) |
888 | break; | 888 | break; |
889 | } | 889 | } |
890 | hci_dev_unlock_bh(hdev); | 890 | hci_dev_unlock(hdev); |
891 | 891 | ||
892 | cl->dev_id = hdev->id; | 892 | cl->dev_id = hdev->id; |
893 | cl->conn_num = n; | 893 | cl->conn_num = n; |
@@ -911,7 +911,7 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg) | |||
911 | if (copy_from_user(&req, arg, sizeof(req))) | 911 | if (copy_from_user(&req, arg, sizeof(req))) |
912 | return -EFAULT; | 912 | return -EFAULT; |
913 | 913 | ||
914 | hci_dev_lock_bh(hdev); | 914 | hci_dev_lock(hdev); |
915 | conn = hci_conn_hash_lookup_ba(hdev, req.type, &req.bdaddr); | 915 | conn = hci_conn_hash_lookup_ba(hdev, req.type, &req.bdaddr); |
916 | if (conn) { | 916 | if (conn) { |
917 | bacpy(&ci.bdaddr, &conn->dst); | 917 | bacpy(&ci.bdaddr, &conn->dst); |
@@ -921,7 +921,7 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg) | |||
921 | ci.state = conn->state; | 921 | ci.state = conn->state; |
922 | ci.link_mode = conn->link_mode; | 922 | ci.link_mode = conn->link_mode; |
923 | } | 923 | } |
924 | hci_dev_unlock_bh(hdev); | 924 | hci_dev_unlock(hdev); |
925 | 925 | ||
926 | if (!conn) | 926 | if (!conn) |
927 | return -ENOENT; | 927 | return -ENOENT; |
@@ -937,11 +937,11 @@ int hci_get_auth_info(struct hci_dev *hdev, void __user *arg) | |||
937 | if (copy_from_user(&req, arg, sizeof(req))) | 937 | if (copy_from_user(&req, arg, sizeof(req))) |
938 | return -EFAULT; | 938 | return -EFAULT; |
939 | 939 | ||
940 | hci_dev_lock_bh(hdev); | 940 | hci_dev_lock(hdev); |
941 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &req.bdaddr); | 941 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &req.bdaddr); |
942 | if (conn) | 942 | if (conn) |
943 | req.type = conn->auth_type; | 943 | req.type = conn->auth_type; |
944 | hci_dev_unlock_bh(hdev); | 944 | hci_dev_unlock(hdev); |
945 | 945 | ||
946 | if (!conn) | 946 | if (!conn) |
947 | return -ENOENT; | 947 | return -ENOENT; |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 4f15722c56dc..ec1019178f80 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -433,14 +433,14 @@ int hci_inquiry(void __user *arg) | |||
433 | if (!hdev) | 433 | if (!hdev) |
434 | return -ENODEV; | 434 | return -ENODEV; |
435 | 435 | ||
436 | hci_dev_lock_bh(hdev); | 436 | hci_dev_lock(hdev); |
437 | if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || | 437 | if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || |
438 | inquiry_cache_empty(hdev) || | 438 | inquiry_cache_empty(hdev) || |
439 | ir.flags & IREQ_CACHE_FLUSH) { | 439 | ir.flags & IREQ_CACHE_FLUSH) { |
440 | inquiry_cache_flush(hdev); | 440 | inquiry_cache_flush(hdev); |
441 | do_inquiry = 1; | 441 | do_inquiry = 1; |
442 | } | 442 | } |
443 | hci_dev_unlock_bh(hdev); | 443 | hci_dev_unlock(hdev); |
444 | 444 | ||
445 | timeo = ir.length * msecs_to_jiffies(2000); | 445 | timeo = ir.length * msecs_to_jiffies(2000); |
446 | 446 | ||
@@ -462,9 +462,9 @@ int hci_inquiry(void __user *arg) | |||
462 | goto done; | 462 | goto done; |
463 | } | 463 | } |
464 | 464 | ||
465 | hci_dev_lock_bh(hdev); | 465 | hci_dev_lock(hdev); |
466 | ir.num_rsp = inquiry_cache_dump(hdev, max_rsp, buf); | 466 | ir.num_rsp = inquiry_cache_dump(hdev, max_rsp, buf); |
467 | hci_dev_unlock_bh(hdev); | 467 | hci_dev_unlock(hdev); |
468 | 468 | ||
469 | BT_DBG("num_rsp %d", ir.num_rsp); | 469 | BT_DBG("num_rsp %d", ir.num_rsp); |
470 | 470 | ||
@@ -541,9 +541,9 @@ int hci_dev_open(__u16 dev) | |||
541 | set_bit(HCI_UP, &hdev->flags); | 541 | set_bit(HCI_UP, &hdev->flags); |
542 | hci_notify(hdev, HCI_DEV_UP); | 542 | hci_notify(hdev, HCI_DEV_UP); |
543 | if (!test_bit(HCI_SETUP, &hdev->flags)) { | 543 | if (!test_bit(HCI_SETUP, &hdev->flags)) { |
544 | hci_dev_lock_bh(hdev); | 544 | hci_dev_lock(hdev); |
545 | mgmt_powered(hdev, 1); | 545 | mgmt_powered(hdev, 1); |
546 | hci_dev_unlock_bh(hdev); | 546 | hci_dev_unlock(hdev); |
547 | } | 547 | } |
548 | } else { | 548 | } else { |
549 | /* Init failed, cleanup */ | 549 | /* Init failed, cleanup */ |
@@ -597,10 +597,10 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
597 | if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->flags)) | 597 | if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->flags)) |
598 | cancel_delayed_work(&hdev->power_off); | 598 | cancel_delayed_work(&hdev->power_off); |
599 | 599 | ||
600 | hci_dev_lock_bh(hdev); | 600 | hci_dev_lock(hdev); |
601 | inquiry_cache_flush(hdev); | 601 | inquiry_cache_flush(hdev); |
602 | hci_conn_hash_flush(hdev); | 602 | hci_conn_hash_flush(hdev); |
603 | hci_dev_unlock_bh(hdev); | 603 | hci_dev_unlock(hdev); |
604 | 604 | ||
605 | hci_notify(hdev, HCI_DEV_DOWN); | 605 | hci_notify(hdev, HCI_DEV_DOWN); |
606 | 606 | ||
@@ -636,9 +636,9 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
636 | * and no tasks are scheduled. */ | 636 | * and no tasks are scheduled. */ |
637 | hdev->close(hdev); | 637 | hdev->close(hdev); |
638 | 638 | ||
639 | hci_dev_lock_bh(hdev); | 639 | hci_dev_lock(hdev); |
640 | mgmt_powered(hdev, 0); | 640 | mgmt_powered(hdev, 0); |
641 | hci_dev_unlock_bh(hdev); | 641 | hci_dev_unlock(hdev); |
642 | 642 | ||
643 | /* Clear flags */ | 643 | /* Clear flags */ |
644 | hdev->flags = 0; | 644 | hdev->flags = 0; |
@@ -681,10 +681,10 @@ int hci_dev_reset(__u16 dev) | |||
681 | skb_queue_purge(&hdev->rx_q); | 681 | skb_queue_purge(&hdev->rx_q); |
682 | skb_queue_purge(&hdev->cmd_q); | 682 | skb_queue_purge(&hdev->cmd_q); |
683 | 683 | ||
684 | hci_dev_lock_bh(hdev); | 684 | hci_dev_lock(hdev); |
685 | inquiry_cache_flush(hdev); | 685 | inquiry_cache_flush(hdev); |
686 | hci_conn_hash_flush(hdev); | 686 | hci_conn_hash_flush(hdev); |
687 | hci_dev_unlock_bh(hdev); | 687 | hci_dev_unlock(hdev); |
688 | 688 | ||
689 | if (hdev->flush) | 689 | if (hdev->flush) |
690 | hdev->flush(hdev); | 690 | hdev->flush(hdev); |
@@ -967,13 +967,13 @@ static void hci_discov_off(struct work_struct *work) | |||
967 | 967 | ||
968 | BT_DBG("%s", hdev->name); | 968 | BT_DBG("%s", hdev->name); |
969 | 969 | ||
970 | hci_dev_lock_bh(hdev); | 970 | hci_dev_lock(hdev); |
971 | 971 | ||
972 | hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, sizeof(scan), &scan); | 972 | hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, sizeof(scan), &scan); |
973 | 973 | ||
974 | hdev->discov_timeout = 0; | 974 | hdev->discov_timeout = 0; |
975 | 975 | ||
976 | hci_dev_unlock_bh(hdev); | 976 | hci_dev_unlock(hdev); |
977 | } | 977 | } |
978 | 978 | ||
979 | int hci_uuids_clear(struct hci_dev *hdev) | 979 | int hci_uuids_clear(struct hci_dev *hdev) |
@@ -1443,7 +1443,7 @@ int hci_register_dev(struct hci_dev *hdev) | |||
1443 | list_add_tail(&hdev->list, head); | 1443 | list_add_tail(&hdev->list, head); |
1444 | 1444 | ||
1445 | atomic_set(&hdev->refcnt, 1); | 1445 | atomic_set(&hdev->refcnt, 1); |
1446 | spin_lock_init(&hdev->lock); | 1446 | mutex_init(&hdev->lock); |
1447 | 1447 | ||
1448 | hdev->flags = 0; | 1448 | hdev->flags = 0; |
1449 | hdev->dev_flags = 0; | 1449 | hdev->dev_flags = 0; |
@@ -1558,9 +1558,9 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
1558 | 1558 | ||
1559 | if (!test_bit(HCI_INIT, &hdev->flags) && | 1559 | if (!test_bit(HCI_INIT, &hdev->flags) && |
1560 | !test_bit(HCI_SETUP, &hdev->flags)) { | 1560 | !test_bit(HCI_SETUP, &hdev->flags)) { |
1561 | hci_dev_lock_bh(hdev); | 1561 | hci_dev_lock(hdev); |
1562 | mgmt_index_removed(hdev); | 1562 | mgmt_index_removed(hdev); |
1563 | hci_dev_unlock_bh(hdev); | 1563 | hci_dev_unlock(hdev); |
1564 | } | 1564 | } |
1565 | 1565 | ||
1566 | /* mgmt_index_removed should take care of emptying the | 1566 | /* mgmt_index_removed should take care of emptying the |
@@ -1580,13 +1580,13 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
1580 | 1580 | ||
1581 | destroy_workqueue(hdev->workqueue); | 1581 | destroy_workqueue(hdev->workqueue); |
1582 | 1582 | ||
1583 | hci_dev_lock_bh(hdev); | 1583 | hci_dev_lock(hdev); |
1584 | hci_blacklist_clear(hdev); | 1584 | hci_blacklist_clear(hdev); |
1585 | hci_uuids_clear(hdev); | 1585 | hci_uuids_clear(hdev); |
1586 | hci_link_keys_clear(hdev); | 1586 | hci_link_keys_clear(hdev); |
1587 | hci_remote_oob_data_clear(hdev); | 1587 | hci_remote_oob_data_clear(hdev); |
1588 | hci_adv_entries_clear(hdev); | 1588 | hci_adv_entries_clear(hdev); |
1589 | hci_dev_unlock_bh(hdev); | 1589 | hci_dev_unlock(hdev); |
1590 | 1590 | ||
1591 | __hci_dev_put(hdev); | 1591 | __hci_dev_put(hdev); |
1592 | } | 1592 | } |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index f6afe3d76a66..399be345ea22 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -188,11 +188,11 @@ static int hci_sock_blacklist_add(struct hci_dev *hdev, void __user *arg) | |||
188 | if (copy_from_user(&bdaddr, arg, sizeof(bdaddr))) | 188 | if (copy_from_user(&bdaddr, arg, sizeof(bdaddr))) |
189 | return -EFAULT; | 189 | return -EFAULT; |
190 | 190 | ||
191 | hci_dev_lock_bh(hdev); | 191 | hci_dev_lock(hdev); |
192 | 192 | ||
193 | err = hci_blacklist_add(hdev, &bdaddr); | 193 | err = hci_blacklist_add(hdev, &bdaddr); |
194 | 194 | ||
195 | hci_dev_unlock_bh(hdev); | 195 | hci_dev_unlock(hdev); |
196 | 196 | ||
197 | return err; | 197 | return err; |
198 | } | 198 | } |
@@ -205,11 +205,11 @@ static int hci_sock_blacklist_del(struct hci_dev *hdev, void __user *arg) | |||
205 | if (copy_from_user(&bdaddr, arg, sizeof(bdaddr))) | 205 | if (copy_from_user(&bdaddr, arg, sizeof(bdaddr))) |
206 | return -EFAULT; | 206 | return -EFAULT; |
207 | 207 | ||
208 | hci_dev_lock_bh(hdev); | 208 | hci_dev_lock(hdev); |
209 | 209 | ||
210 | err = hci_blacklist_del(hdev, &bdaddr); | 210 | err = hci_blacklist_del(hdev, &bdaddr); |
211 | 211 | ||
212 | hci_dev_unlock_bh(hdev); | 212 | hci_dev_unlock(hdev); |
213 | 213 | ||
214 | return err; | 214 | return err; |
215 | } | 215 | } |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index f8e6aa386cef..c3c1ec871d46 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -402,7 +402,7 @@ static int inquiry_cache_show(struct seq_file *f, void *p) | |||
402 | struct inquiry_cache *cache = &hdev->inq_cache; | 402 | struct inquiry_cache *cache = &hdev->inq_cache; |
403 | struct inquiry_entry *e; | 403 | struct inquiry_entry *e; |
404 | 404 | ||
405 | hci_dev_lock_bh(hdev); | 405 | hci_dev_lock(hdev); |
406 | 406 | ||
407 | for (e = cache->list; e; e = e->next) { | 407 | for (e = cache->list; e; e = e->next) { |
408 | struct inquiry_data *data = &e->data; | 408 | struct inquiry_data *data = &e->data; |
@@ -415,7 +415,7 @@ static int inquiry_cache_show(struct seq_file *f, void *p) | |||
415 | data->rssi, data->ssp_mode, e->timestamp); | 415 | data->rssi, data->ssp_mode, e->timestamp); |
416 | } | 416 | } |
417 | 417 | ||
418 | hci_dev_unlock_bh(hdev); | 418 | hci_dev_unlock(hdev); |
419 | 419 | ||
420 | return 0; | 420 | return 0; |
421 | } | 421 | } |
@@ -437,12 +437,12 @@ static int blacklist_show(struct seq_file *f, void *p) | |||
437 | struct hci_dev *hdev = f->private; | 437 | struct hci_dev *hdev = f->private; |
438 | struct bdaddr_list *b; | 438 | struct bdaddr_list *b; |
439 | 439 | ||
440 | hci_dev_lock_bh(hdev); | 440 | hci_dev_lock(hdev); |
441 | 441 | ||
442 | list_for_each_entry(b, &hdev->blacklist, list) | 442 | list_for_each_entry(b, &hdev->blacklist, list) |
443 | seq_printf(f, "%s\n", batostr(&b->bdaddr)); | 443 | seq_printf(f, "%s\n", batostr(&b->bdaddr)); |
444 | 444 | ||
445 | hci_dev_unlock_bh(hdev); | 445 | hci_dev_unlock(hdev); |
446 | 446 | ||
447 | return 0; | 447 | return 0; |
448 | } | 448 | } |
@@ -481,12 +481,12 @@ static int uuids_show(struct seq_file *f, void *p) | |||
481 | struct hci_dev *hdev = f->private; | 481 | struct hci_dev *hdev = f->private; |
482 | struct bt_uuid *uuid; | 482 | struct bt_uuid *uuid; |
483 | 483 | ||
484 | hci_dev_lock_bh(hdev); | 484 | hci_dev_lock(hdev); |
485 | 485 | ||
486 | list_for_each_entry(uuid, &hdev->uuids, list) | 486 | list_for_each_entry(uuid, &hdev->uuids, list) |
487 | print_bt_uuid(f, uuid->uuid); | 487 | print_bt_uuid(f, uuid->uuid); |
488 | 488 | ||
489 | hci_dev_unlock_bh(hdev); | 489 | hci_dev_unlock(hdev); |
490 | 490 | ||
491 | return 0; | 491 | return 0; |
492 | } | 492 | } |
@@ -507,11 +507,11 @@ static int auto_accept_delay_set(void *data, u64 val) | |||
507 | { | 507 | { |
508 | struct hci_dev *hdev = data; | 508 | struct hci_dev *hdev = data; |
509 | 509 | ||
510 | hci_dev_lock_bh(hdev); | 510 | hci_dev_lock(hdev); |
511 | 511 | ||
512 | hdev->auto_accept_delay = val; | 512 | hdev->auto_accept_delay = val; |
513 | 513 | ||
514 | hci_dev_unlock_bh(hdev); | 514 | hci_dev_unlock(hdev); |
515 | 515 | ||
516 | return 0; | 516 | return 0; |
517 | } | 517 | } |
@@ -520,11 +520,11 @@ static int auto_accept_delay_get(void *data, u64 *val) | |||
520 | { | 520 | { |
521 | struct hci_dev *hdev = data; | 521 | struct hci_dev *hdev = data; |
522 | 522 | ||
523 | hci_dev_lock_bh(hdev); | 523 | hci_dev_lock(hdev); |
524 | 524 | ||
525 | *val = hdev->auto_accept_delay; | 525 | *val = hdev->auto_accept_delay; |
526 | 526 | ||
527 | hci_dev_unlock_bh(hdev); | 527 | hci_dev_unlock(hdev); |
528 | 528 | ||
529 | return 0; | 529 | return 0; |
530 | } | 530 | } |
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 3c2d888925d7..d478be11d562 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -795,11 +795,11 @@ static struct hci_conn *hidp_get_connection(struct hidp_session *session) | |||
795 | if (!hdev) | 795 | if (!hdev) |
796 | return NULL; | 796 | return NULL; |
797 | 797 | ||
798 | hci_dev_lock_bh(hdev); | 798 | hci_dev_lock(hdev); |
799 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); | 799 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); |
800 | if (conn) | 800 | if (conn) |
801 | hci_conn_hold_device(conn); | 801 | hci_conn_hold_device(conn); |
802 | hci_dev_unlock_bh(hdev); | 802 | hci_dev_unlock(hdev); |
803 | 803 | ||
804 | hci_dev_put(hdev); | 804 | hci_dev_put(hdev); |
805 | 805 | ||
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 014fdec17113..0369a9bf60c6 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1171,7 +1171,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan) | |||
1171 | if (!hdev) | 1171 | if (!hdev) |
1172 | return -EHOSTUNREACH; | 1172 | return -EHOSTUNREACH; |
1173 | 1173 | ||
1174 | hci_dev_lock_bh(hdev); | 1174 | hci_dev_lock(hdev); |
1175 | 1175 | ||
1176 | auth_type = l2cap_get_auth_type(chan); | 1176 | auth_type = l2cap_get_auth_type(chan); |
1177 | 1177 | ||
@@ -1214,7 +1214,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan) | |||
1214 | err = 0; | 1214 | err = 0; |
1215 | 1215 | ||
1216 | done: | 1216 | done: |
1217 | hci_dev_unlock_bh(hdev); | 1217 | hci_dev_unlock(hdev); |
1218 | hci_dev_put(hdev); | 1218 | hci_dev_put(hdev); |
1219 | return err; | 1219 | return err; |
1220 | } | 1220 | } |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 7a23f211d602..ad4817c9ef2f 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -257,7 +257,7 @@ static int read_controller_info(struct sock *sk, u16 index) | |||
257 | if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->flags)) | 257 | if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->flags)) |
258 | cancel_delayed_work_sync(&hdev->power_off); | 258 | cancel_delayed_work_sync(&hdev->power_off); |
259 | 259 | ||
260 | hci_dev_lock_bh(hdev); | 260 | hci_dev_lock(hdev); |
261 | 261 | ||
262 | set_bit(HCI_MGMT, &hdev->flags); | 262 | set_bit(HCI_MGMT, &hdev->flags); |
263 | 263 | ||
@@ -286,7 +286,7 @@ static int read_controller_info(struct sock *sk, u16 index) | |||
286 | 286 | ||
287 | memcpy(rp.name, hdev->dev_name, sizeof(hdev->dev_name)); | 287 | memcpy(rp.name, hdev->dev_name, sizeof(hdev->dev_name)); |
288 | 288 | ||
289 | hci_dev_unlock_bh(hdev); | 289 | hci_dev_unlock(hdev); |
290 | hci_dev_put(hdev); | 290 | hci_dev_put(hdev); |
291 | 291 | ||
292 | return cmd_complete(sk, index, MGMT_OP_READ_INFO, &rp, sizeof(rp)); | 292 | return cmd_complete(sk, index, MGMT_OP_READ_INFO, &rp, sizeof(rp)); |
@@ -394,7 +394,7 @@ static int set_powered(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
394 | return cmd_status(sk, index, MGMT_OP_SET_POWERED, | 394 | return cmd_status(sk, index, MGMT_OP_SET_POWERED, |
395 | MGMT_STATUS_INVALID_PARAMS); | 395 | MGMT_STATUS_INVALID_PARAMS); |
396 | 396 | ||
397 | hci_dev_lock_bh(hdev); | 397 | hci_dev_lock(hdev); |
398 | 398 | ||
399 | up = test_bit(HCI_UP, &hdev->flags); | 399 | up = test_bit(HCI_UP, &hdev->flags); |
400 | if ((cp->val && up) || (!cp->val && !up)) { | 400 | if ((cp->val && up) || (!cp->val && !up)) { |
@@ -422,7 +422,7 @@ static int set_powered(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
422 | err = 0; | 422 | err = 0; |
423 | 423 | ||
424 | failed: | 424 | failed: |
425 | hci_dev_unlock_bh(hdev); | 425 | hci_dev_unlock(hdev); |
426 | hci_dev_put(hdev); | 426 | hci_dev_put(hdev); |
427 | return err; | 427 | return err; |
428 | } | 428 | } |
@@ -449,7 +449,7 @@ static int set_discoverable(struct sock *sk, u16 index, unsigned char *data, | |||
449 | return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, | 449 | return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, |
450 | MGMT_STATUS_INVALID_PARAMS); | 450 | MGMT_STATUS_INVALID_PARAMS); |
451 | 451 | ||
452 | hci_dev_lock_bh(hdev); | 452 | hci_dev_lock(hdev); |
453 | 453 | ||
454 | if (!test_bit(HCI_UP, &hdev->flags)) { | 454 | if (!test_bit(HCI_UP, &hdev->flags)) { |
455 | err = cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, | 455 | err = cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, |
@@ -492,7 +492,7 @@ static int set_discoverable(struct sock *sk, u16 index, unsigned char *data, | |||
492 | hdev->discov_timeout = get_unaligned_le16(&cp->timeout); | 492 | hdev->discov_timeout = get_unaligned_le16(&cp->timeout); |
493 | 493 | ||
494 | failed: | 494 | failed: |
495 | hci_dev_unlock_bh(hdev); | 495 | hci_dev_unlock(hdev); |
496 | hci_dev_put(hdev); | 496 | hci_dev_put(hdev); |
497 | 497 | ||
498 | return err; | 498 | return err; |
@@ -520,7 +520,7 @@ static int set_connectable(struct sock *sk, u16 index, unsigned char *data, | |||
520 | return cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, | 520 | return cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, |
521 | MGMT_STATUS_INVALID_PARAMS); | 521 | MGMT_STATUS_INVALID_PARAMS); |
522 | 522 | ||
523 | hci_dev_lock_bh(hdev); | 523 | hci_dev_lock(hdev); |
524 | 524 | ||
525 | if (!test_bit(HCI_UP, &hdev->flags)) { | 525 | if (!test_bit(HCI_UP, &hdev->flags)) { |
526 | err = cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, | 526 | err = cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, |
@@ -557,7 +557,7 @@ static int set_connectable(struct sock *sk, u16 index, unsigned char *data, | |||
557 | mgmt_pending_remove(cmd); | 557 | mgmt_pending_remove(cmd); |
558 | 558 | ||
559 | failed: | 559 | failed: |
560 | hci_dev_unlock_bh(hdev); | 560 | hci_dev_unlock(hdev); |
561 | hci_dev_put(hdev); | 561 | hci_dev_put(hdev); |
562 | 562 | ||
563 | return err; | 563 | return err; |
@@ -612,7 +612,7 @@ static int set_pairable(struct sock *sk, u16 index, unsigned char *data, | |||
612 | return cmd_status(sk, index, MGMT_OP_SET_PAIRABLE, | 612 | return cmd_status(sk, index, MGMT_OP_SET_PAIRABLE, |
613 | MGMT_STATUS_INVALID_PARAMS); | 613 | MGMT_STATUS_INVALID_PARAMS); |
614 | 614 | ||
615 | hci_dev_lock_bh(hdev); | 615 | hci_dev_lock(hdev); |
616 | 616 | ||
617 | if (cp->val) | 617 | if (cp->val) |
618 | set_bit(HCI_PAIRABLE, &hdev->flags); | 618 | set_bit(HCI_PAIRABLE, &hdev->flags); |
@@ -628,7 +628,7 @@ static int set_pairable(struct sock *sk, u16 index, unsigned char *data, | |||
628 | err = mgmt_event(MGMT_EV_PAIRABLE, hdev, &ev, sizeof(ev), sk); | 628 | err = mgmt_event(MGMT_EV_PAIRABLE, hdev, &ev, sizeof(ev), sk); |
629 | 629 | ||
630 | failed: | 630 | failed: |
631 | hci_dev_unlock_bh(hdev); | 631 | hci_dev_unlock(hdev); |
632 | hci_dev_put(hdev); | 632 | hci_dev_put(hdev); |
633 | 633 | ||
634 | return err; | 634 | return err; |
@@ -827,7 +827,7 @@ static int add_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
827 | return cmd_status(sk, index, MGMT_OP_ADD_UUID, | 827 | return cmd_status(sk, index, MGMT_OP_ADD_UUID, |
828 | MGMT_STATUS_INVALID_PARAMS); | 828 | MGMT_STATUS_INVALID_PARAMS); |
829 | 829 | ||
830 | hci_dev_lock_bh(hdev); | 830 | hci_dev_lock(hdev); |
831 | 831 | ||
832 | uuid = kmalloc(sizeof(*uuid), GFP_ATOMIC); | 832 | uuid = kmalloc(sizeof(*uuid), GFP_ATOMIC); |
833 | if (!uuid) { | 833 | if (!uuid) { |
@@ -851,7 +851,7 @@ static int add_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
851 | err = cmd_complete(sk, index, MGMT_OP_ADD_UUID, NULL, 0); | 851 | err = cmd_complete(sk, index, MGMT_OP_ADD_UUID, NULL, 0); |
852 | 852 | ||
853 | failed: | 853 | failed: |
854 | hci_dev_unlock_bh(hdev); | 854 | hci_dev_unlock(hdev); |
855 | hci_dev_put(hdev); | 855 | hci_dev_put(hdev); |
856 | 856 | ||
857 | return err; | 857 | return err; |
@@ -878,7 +878,7 @@ static int remove_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
878 | return cmd_status(sk, index, MGMT_OP_REMOVE_UUID, | 878 | return cmd_status(sk, index, MGMT_OP_REMOVE_UUID, |
879 | MGMT_STATUS_INVALID_PARAMS); | 879 | MGMT_STATUS_INVALID_PARAMS); |
880 | 880 | ||
881 | hci_dev_lock_bh(hdev); | 881 | hci_dev_lock(hdev); |
882 | 882 | ||
883 | if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) { | 883 | if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) { |
884 | err = hci_uuids_clear(hdev); | 884 | err = hci_uuids_clear(hdev); |
@@ -914,7 +914,7 @@ static int remove_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
914 | err = cmd_complete(sk, index, MGMT_OP_REMOVE_UUID, NULL, 0); | 914 | err = cmd_complete(sk, index, MGMT_OP_REMOVE_UUID, NULL, 0); |
915 | 915 | ||
916 | unlock: | 916 | unlock: |
917 | hci_dev_unlock_bh(hdev); | 917 | hci_dev_unlock(hdev); |
918 | hci_dev_put(hdev); | 918 | hci_dev_put(hdev); |
919 | 919 | ||
920 | return err; | 920 | return err; |
@@ -940,7 +940,7 @@ static int set_dev_class(struct sock *sk, u16 index, unsigned char *data, | |||
940 | return cmd_status(sk, index, MGMT_OP_SET_DEV_CLASS, | 940 | return cmd_status(sk, index, MGMT_OP_SET_DEV_CLASS, |
941 | MGMT_STATUS_INVALID_PARAMS); | 941 | MGMT_STATUS_INVALID_PARAMS); |
942 | 942 | ||
943 | hci_dev_lock_bh(hdev); | 943 | hci_dev_lock(hdev); |
944 | 944 | ||
945 | hdev->major_class = cp->major; | 945 | hdev->major_class = cp->major; |
946 | hdev->minor_class = cp->minor; | 946 | hdev->minor_class = cp->minor; |
@@ -950,7 +950,7 @@ static int set_dev_class(struct sock *sk, u16 index, unsigned char *data, | |||
950 | if (err == 0) | 950 | if (err == 0) |
951 | err = cmd_complete(sk, index, MGMT_OP_SET_DEV_CLASS, NULL, 0); | 951 | err = cmd_complete(sk, index, MGMT_OP_SET_DEV_CLASS, NULL, 0); |
952 | 952 | ||
953 | hci_dev_unlock_bh(hdev); | 953 | hci_dev_unlock(hdev); |
954 | hci_dev_put(hdev); | 954 | hci_dev_put(hdev); |
955 | 955 | ||
956 | return err; | 956 | return err; |
@@ -974,7 +974,7 @@ static int set_service_cache(struct sock *sk, u16 index, unsigned char *data, | |||
974 | return cmd_status(sk, index, MGMT_OP_SET_SERVICE_CACHE, | 974 | return cmd_status(sk, index, MGMT_OP_SET_SERVICE_CACHE, |
975 | MGMT_STATUS_INVALID_PARAMS); | 975 | MGMT_STATUS_INVALID_PARAMS); |
976 | 976 | ||
977 | hci_dev_lock_bh(hdev); | 977 | hci_dev_lock(hdev); |
978 | 978 | ||
979 | BT_DBG("hci%u enable %d", index, cp->enable); | 979 | BT_DBG("hci%u enable %d", index, cp->enable); |
980 | 980 | ||
@@ -995,7 +995,7 @@ static int set_service_cache(struct sock *sk, u16 index, unsigned char *data, | |||
995 | cmd_status(sk, index, MGMT_OP_SET_SERVICE_CACHE, -err); | 995 | cmd_status(sk, index, MGMT_OP_SET_SERVICE_CACHE, -err); |
996 | 996 | ||
997 | 997 | ||
998 | hci_dev_unlock_bh(hdev); | 998 | hci_dev_unlock(hdev); |
999 | hci_dev_put(hdev); | 999 | hci_dev_put(hdev); |
1000 | 1000 | ||
1001 | return err; | 1001 | return err; |
@@ -1034,7 +1034,7 @@ static int load_link_keys(struct sock *sk, u16 index, unsigned char *data, | |||
1034 | BT_DBG("hci%u debug_keys %u key_count %u", index, cp->debug_keys, | 1034 | BT_DBG("hci%u debug_keys %u key_count %u", index, cp->debug_keys, |
1035 | key_count); | 1035 | key_count); |
1036 | 1036 | ||
1037 | hci_dev_lock_bh(hdev); | 1037 | hci_dev_lock(hdev); |
1038 | 1038 | ||
1039 | hci_link_keys_clear(hdev); | 1039 | hci_link_keys_clear(hdev); |
1040 | 1040 | ||
@@ -1054,7 +1054,7 @@ static int load_link_keys(struct sock *sk, u16 index, unsigned char *data, | |||
1054 | 1054 | ||
1055 | cmd_complete(sk, index, MGMT_OP_LOAD_LINK_KEYS, NULL, 0); | 1055 | cmd_complete(sk, index, MGMT_OP_LOAD_LINK_KEYS, NULL, 0); |
1056 | 1056 | ||
1057 | hci_dev_unlock_bh(hdev); | 1057 | hci_dev_unlock(hdev); |
1058 | hci_dev_put(hdev); | 1058 | hci_dev_put(hdev); |
1059 | 1059 | ||
1060 | return 0; | 1060 | return 0; |
@@ -1082,7 +1082,7 @@ static int remove_keys(struct sock *sk, u16 index, unsigned char *data, | |||
1082 | return cmd_status(sk, index, MGMT_OP_REMOVE_KEYS, | 1082 | return cmd_status(sk, index, MGMT_OP_REMOVE_KEYS, |
1083 | MGMT_STATUS_INVALID_PARAMS); | 1083 | MGMT_STATUS_INVALID_PARAMS); |
1084 | 1084 | ||
1085 | hci_dev_lock_bh(hdev); | 1085 | hci_dev_lock(hdev); |
1086 | 1086 | ||
1087 | memset(&rp, 0, sizeof(rp)); | 1087 | memset(&rp, 0, sizeof(rp)); |
1088 | bacpy(&rp.bdaddr, &cp->bdaddr); | 1088 | bacpy(&rp.bdaddr, &cp->bdaddr); |
@@ -1123,7 +1123,7 @@ unlock: | |||
1123 | if (err < 0) | 1123 | if (err < 0) |
1124 | err = cmd_complete(sk, index, MGMT_OP_REMOVE_KEYS, &rp, | 1124 | err = cmd_complete(sk, index, MGMT_OP_REMOVE_KEYS, &rp, |
1125 | sizeof(rp)); | 1125 | sizeof(rp)); |
1126 | hci_dev_unlock_bh(hdev); | 1126 | hci_dev_unlock(hdev); |
1127 | hci_dev_put(hdev); | 1127 | hci_dev_put(hdev); |
1128 | 1128 | ||
1129 | return err; | 1129 | return err; |
@@ -1151,7 +1151,7 @@ static int disconnect(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1151 | return cmd_status(sk, index, MGMT_OP_DISCONNECT, | 1151 | return cmd_status(sk, index, MGMT_OP_DISCONNECT, |
1152 | MGMT_STATUS_INVALID_PARAMS); | 1152 | MGMT_STATUS_INVALID_PARAMS); |
1153 | 1153 | ||
1154 | hci_dev_lock_bh(hdev); | 1154 | hci_dev_lock(hdev); |
1155 | 1155 | ||
1156 | if (!test_bit(HCI_UP, &hdev->flags)) { | 1156 | if (!test_bit(HCI_UP, &hdev->flags)) { |
1157 | err = cmd_status(sk, index, MGMT_OP_DISCONNECT, | 1157 | err = cmd_status(sk, index, MGMT_OP_DISCONNECT, |
@@ -1189,7 +1189,7 @@ static int disconnect(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1189 | mgmt_pending_remove(cmd); | 1189 | mgmt_pending_remove(cmd); |
1190 | 1190 | ||
1191 | failed: | 1191 | failed: |
1192 | hci_dev_unlock_bh(hdev); | 1192 | hci_dev_unlock(hdev); |
1193 | hci_dev_put(hdev); | 1193 | hci_dev_put(hdev); |
1194 | 1194 | ||
1195 | return err; | 1195 | return err; |
@@ -1231,7 +1231,7 @@ static int get_connections(struct sock *sk, u16 index) | |||
1231 | return cmd_status(sk, index, MGMT_OP_GET_CONNECTIONS, | 1231 | return cmd_status(sk, index, MGMT_OP_GET_CONNECTIONS, |
1232 | MGMT_STATUS_INVALID_PARAMS); | 1232 | MGMT_STATUS_INVALID_PARAMS); |
1233 | 1233 | ||
1234 | hci_dev_lock_bh(hdev); | 1234 | hci_dev_lock(hdev); |
1235 | 1235 | ||
1236 | count = 0; | 1236 | count = 0; |
1237 | list_for_each(p, &hdev->conn_hash.list) { | 1237 | list_for_each(p, &hdev->conn_hash.list) { |
@@ -1263,7 +1263,7 @@ static int get_connections(struct sock *sk, u16 index) | |||
1263 | 1263 | ||
1264 | unlock: | 1264 | unlock: |
1265 | kfree(rp); | 1265 | kfree(rp); |
1266 | hci_dev_unlock_bh(hdev); | 1266 | hci_dev_unlock(hdev); |
1267 | hci_dev_put(hdev); | 1267 | hci_dev_put(hdev); |
1268 | return err; | 1268 | return err; |
1269 | } | 1269 | } |
@@ -1311,7 +1311,7 @@ static int pin_code_reply(struct sock *sk, u16 index, unsigned char *data, | |||
1311 | return cmd_status(sk, index, MGMT_OP_PIN_CODE_REPLY, | 1311 | return cmd_status(sk, index, MGMT_OP_PIN_CODE_REPLY, |
1312 | MGMT_STATUS_INVALID_PARAMS); | 1312 | MGMT_STATUS_INVALID_PARAMS); |
1313 | 1313 | ||
1314 | hci_dev_lock_bh(hdev); | 1314 | hci_dev_lock(hdev); |
1315 | 1315 | ||
1316 | if (!test_bit(HCI_UP, &hdev->flags)) { | 1316 | if (!test_bit(HCI_UP, &hdev->flags)) { |
1317 | err = cmd_status(sk, index, MGMT_OP_PIN_CODE_REPLY, | 1317 | err = cmd_status(sk, index, MGMT_OP_PIN_CODE_REPLY, |
@@ -1354,7 +1354,7 @@ static int pin_code_reply(struct sock *sk, u16 index, unsigned char *data, | |||
1354 | mgmt_pending_remove(cmd); | 1354 | mgmt_pending_remove(cmd); |
1355 | 1355 | ||
1356 | failed: | 1356 | failed: |
1357 | hci_dev_unlock_bh(hdev); | 1357 | hci_dev_unlock(hdev); |
1358 | hci_dev_put(hdev); | 1358 | hci_dev_put(hdev); |
1359 | 1359 | ||
1360 | return err; | 1360 | return err; |
@@ -1380,7 +1380,7 @@ static int pin_code_neg_reply(struct sock *sk, u16 index, unsigned char *data, | |||
1380 | return cmd_status(sk, index, MGMT_OP_PIN_CODE_NEG_REPLY, | 1380 | return cmd_status(sk, index, MGMT_OP_PIN_CODE_NEG_REPLY, |
1381 | MGMT_STATUS_INVALID_PARAMS); | 1381 | MGMT_STATUS_INVALID_PARAMS); |
1382 | 1382 | ||
1383 | hci_dev_lock_bh(hdev); | 1383 | hci_dev_lock(hdev); |
1384 | 1384 | ||
1385 | if (!test_bit(HCI_UP, &hdev->flags)) { | 1385 | if (!test_bit(HCI_UP, &hdev->flags)) { |
1386 | err = cmd_status(sk, index, MGMT_OP_PIN_CODE_NEG_REPLY, | 1386 | err = cmd_status(sk, index, MGMT_OP_PIN_CODE_NEG_REPLY, |
@@ -1391,7 +1391,7 @@ static int pin_code_neg_reply(struct sock *sk, u16 index, unsigned char *data, | |||
1391 | err = send_pin_code_neg_reply(sk, index, hdev, cp); | 1391 | err = send_pin_code_neg_reply(sk, index, hdev, cp); |
1392 | 1392 | ||
1393 | failed: | 1393 | failed: |
1394 | hci_dev_unlock_bh(hdev); | 1394 | hci_dev_unlock(hdev); |
1395 | hci_dev_put(hdev); | 1395 | hci_dev_put(hdev); |
1396 | 1396 | ||
1397 | return err; | 1397 | return err; |
@@ -1416,14 +1416,14 @@ static int set_io_capability(struct sock *sk, u16 index, unsigned char *data, | |||
1416 | return cmd_status(sk, index, MGMT_OP_SET_IO_CAPABILITY, | 1416 | return cmd_status(sk, index, MGMT_OP_SET_IO_CAPABILITY, |
1417 | MGMT_STATUS_INVALID_PARAMS); | 1417 | MGMT_STATUS_INVALID_PARAMS); |
1418 | 1418 | ||
1419 | hci_dev_lock_bh(hdev); | 1419 | hci_dev_lock(hdev); |
1420 | 1420 | ||
1421 | hdev->io_capability = cp->io_capability; | 1421 | hdev->io_capability = cp->io_capability; |
1422 | 1422 | ||
1423 | BT_DBG("%s IO capability set to 0x%02x", hdev->name, | 1423 | BT_DBG("%s IO capability set to 0x%02x", hdev->name, |
1424 | hdev->io_capability); | 1424 | hdev->io_capability); |
1425 | 1425 | ||
1426 | hci_dev_unlock_bh(hdev); | 1426 | hci_dev_unlock(hdev); |
1427 | hci_dev_put(hdev); | 1427 | hci_dev_put(hdev); |
1428 | 1428 | ||
1429 | return cmd_complete(sk, index, MGMT_OP_SET_IO_CAPABILITY, NULL, 0); | 1429 | return cmd_complete(sk, index, MGMT_OP_SET_IO_CAPABILITY, NULL, 0); |
@@ -1504,7 +1504,7 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1504 | return cmd_status(sk, index, MGMT_OP_PAIR_DEVICE, | 1504 | return cmd_status(sk, index, MGMT_OP_PAIR_DEVICE, |
1505 | MGMT_STATUS_INVALID_PARAMS); | 1505 | MGMT_STATUS_INVALID_PARAMS); |
1506 | 1506 | ||
1507 | hci_dev_lock_bh(hdev); | 1507 | hci_dev_lock(hdev); |
1508 | 1508 | ||
1509 | sec_level = BT_SECURITY_MEDIUM; | 1509 | sec_level = BT_SECURITY_MEDIUM; |
1510 | if (cp->io_cap == 0x03) | 1510 | if (cp->io_cap == 0x03) |
@@ -1561,7 +1561,7 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1561 | err = 0; | 1561 | err = 0; |
1562 | 1562 | ||
1563 | unlock: | 1563 | unlock: |
1564 | hci_dev_unlock_bh(hdev); | 1564 | hci_dev_unlock(hdev); |
1565 | hci_dev_put(hdev); | 1565 | hci_dev_put(hdev); |
1566 | 1566 | ||
1567 | return err; | 1567 | return err; |
@@ -1580,7 +1580,7 @@ static int user_pairing_resp(struct sock *sk, u16 index, bdaddr_t *bdaddr, | |||
1580 | return cmd_status(sk, index, mgmt_op, | 1580 | return cmd_status(sk, index, mgmt_op, |
1581 | MGMT_STATUS_INVALID_PARAMS); | 1581 | MGMT_STATUS_INVALID_PARAMS); |
1582 | 1582 | ||
1583 | hci_dev_lock_bh(hdev); | 1583 | hci_dev_lock(hdev); |
1584 | 1584 | ||
1585 | if (!test_bit(HCI_UP, &hdev->flags)) { | 1585 | if (!test_bit(HCI_UP, &hdev->flags)) { |
1586 | err = cmd_status(sk, index, mgmt_op, MGMT_STATUS_NOT_POWERED); | 1586 | err = cmd_status(sk, index, mgmt_op, MGMT_STATUS_NOT_POWERED); |
@@ -1631,7 +1631,7 @@ static int user_pairing_resp(struct sock *sk, u16 index, bdaddr_t *bdaddr, | |||
1631 | mgmt_pending_remove(cmd); | 1631 | mgmt_pending_remove(cmd); |
1632 | 1632 | ||
1633 | done: | 1633 | done: |
1634 | hci_dev_unlock_bh(hdev); | 1634 | hci_dev_unlock(hdev); |
1635 | hci_dev_put(hdev); | 1635 | hci_dev_put(hdev); |
1636 | 1636 | ||
1637 | return err; | 1637 | return err; |
@@ -1719,7 +1719,7 @@ static int set_local_name(struct sock *sk, u16 index, unsigned char *data, | |||
1719 | return cmd_status(sk, index, MGMT_OP_SET_LOCAL_NAME, | 1719 | return cmd_status(sk, index, MGMT_OP_SET_LOCAL_NAME, |
1720 | MGMT_STATUS_INVALID_PARAMS); | 1720 | MGMT_STATUS_INVALID_PARAMS); |
1721 | 1721 | ||
1722 | hci_dev_lock_bh(hdev); | 1722 | hci_dev_lock(hdev); |
1723 | 1723 | ||
1724 | cmd = mgmt_pending_add(sk, MGMT_OP_SET_LOCAL_NAME, hdev, data, len); | 1724 | cmd = mgmt_pending_add(sk, MGMT_OP_SET_LOCAL_NAME, hdev, data, len); |
1725 | if (!cmd) { | 1725 | if (!cmd) { |
@@ -1734,7 +1734,7 @@ static int set_local_name(struct sock *sk, u16 index, unsigned char *data, | |||
1734 | mgmt_pending_remove(cmd); | 1734 | mgmt_pending_remove(cmd); |
1735 | 1735 | ||
1736 | failed: | 1736 | failed: |
1737 | hci_dev_unlock_bh(hdev); | 1737 | hci_dev_unlock(hdev); |
1738 | hci_dev_put(hdev); | 1738 | hci_dev_put(hdev); |
1739 | 1739 | ||
1740 | return err; | 1740 | return err; |
@@ -1753,7 +1753,7 @@ static int read_local_oob_data(struct sock *sk, u16 index) | |||
1753 | return cmd_status(sk, index, MGMT_OP_READ_LOCAL_OOB_DATA, | 1753 | return cmd_status(sk, index, MGMT_OP_READ_LOCAL_OOB_DATA, |
1754 | MGMT_STATUS_INVALID_PARAMS); | 1754 | MGMT_STATUS_INVALID_PARAMS); |
1755 | 1755 | ||
1756 | hci_dev_lock_bh(hdev); | 1756 | hci_dev_lock(hdev); |
1757 | 1757 | ||
1758 | if (!test_bit(HCI_UP, &hdev->flags)) { | 1758 | if (!test_bit(HCI_UP, &hdev->flags)) { |
1759 | err = cmd_status(sk, index, MGMT_OP_READ_LOCAL_OOB_DATA, | 1759 | err = cmd_status(sk, index, MGMT_OP_READ_LOCAL_OOB_DATA, |
@@ -1784,7 +1784,7 @@ static int read_local_oob_data(struct sock *sk, u16 index) | |||
1784 | mgmt_pending_remove(cmd); | 1784 | mgmt_pending_remove(cmd); |
1785 | 1785 | ||
1786 | unlock: | 1786 | unlock: |
1787 | hci_dev_unlock_bh(hdev); | 1787 | hci_dev_unlock(hdev); |
1788 | hci_dev_put(hdev); | 1788 | hci_dev_put(hdev); |
1789 | 1789 | ||
1790 | return err; | 1790 | return err; |
@@ -1808,7 +1808,7 @@ static int add_remote_oob_data(struct sock *sk, u16 index, unsigned char *data, | |||
1808 | return cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, | 1808 | return cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, |
1809 | MGMT_STATUS_INVALID_PARAMS); | 1809 | MGMT_STATUS_INVALID_PARAMS); |
1810 | 1810 | ||
1811 | hci_dev_lock_bh(hdev); | 1811 | hci_dev_lock(hdev); |
1812 | 1812 | ||
1813 | err = hci_add_remote_oob_data(hdev, &cp->bdaddr, cp->hash, | 1813 | err = hci_add_remote_oob_data(hdev, &cp->bdaddr, cp->hash, |
1814 | cp->randomizer); | 1814 | cp->randomizer); |
@@ -1819,7 +1819,7 @@ static int add_remote_oob_data(struct sock *sk, u16 index, unsigned char *data, | |||
1819 | err = cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, NULL, | 1819 | err = cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, NULL, |
1820 | 0); | 1820 | 0); |
1821 | 1821 | ||
1822 | hci_dev_unlock_bh(hdev); | 1822 | hci_dev_unlock(hdev); |
1823 | hci_dev_put(hdev); | 1823 | hci_dev_put(hdev); |
1824 | 1824 | ||
1825 | return err; | 1825 | return err; |
@@ -1843,7 +1843,7 @@ static int remove_remote_oob_data(struct sock *sk, u16 index, | |||
1843 | return cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, | 1843 | return cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, |
1844 | MGMT_STATUS_INVALID_PARAMS); | 1844 | MGMT_STATUS_INVALID_PARAMS); |
1845 | 1845 | ||
1846 | hci_dev_lock_bh(hdev); | 1846 | hci_dev_lock(hdev); |
1847 | 1847 | ||
1848 | err = hci_remove_remote_oob_data(hdev, &cp->bdaddr); | 1848 | err = hci_remove_remote_oob_data(hdev, &cp->bdaddr); |
1849 | if (err < 0) | 1849 | if (err < 0) |
@@ -1853,7 +1853,7 @@ static int remove_remote_oob_data(struct sock *sk, u16 index, | |||
1853 | err = cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, | 1853 | err = cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, |
1854 | NULL, 0); | 1854 | NULL, 0); |
1855 | 1855 | ||
1856 | hci_dev_unlock_bh(hdev); | 1856 | hci_dev_unlock(hdev); |
1857 | hci_dev_put(hdev); | 1857 | hci_dev_put(hdev); |
1858 | 1858 | ||
1859 | return err; | 1859 | return err; |
@@ -1878,7 +1878,7 @@ static int start_discovery(struct sock *sk, u16 index, | |||
1878 | return cmd_status(sk, index, MGMT_OP_START_DISCOVERY, | 1878 | return cmd_status(sk, index, MGMT_OP_START_DISCOVERY, |
1879 | MGMT_STATUS_INVALID_PARAMS); | 1879 | MGMT_STATUS_INVALID_PARAMS); |
1880 | 1880 | ||
1881 | hci_dev_lock_bh(hdev); | 1881 | hci_dev_lock(hdev); |
1882 | 1882 | ||
1883 | if (!test_bit(HCI_UP, &hdev->flags)) { | 1883 | if (!test_bit(HCI_UP, &hdev->flags)) { |
1884 | err = cmd_status(sk, index, MGMT_OP_START_DISCOVERY, | 1884 | err = cmd_status(sk, index, MGMT_OP_START_DISCOVERY, |
@@ -1897,7 +1897,7 @@ static int start_discovery(struct sock *sk, u16 index, | |||
1897 | mgmt_pending_remove(cmd); | 1897 | mgmt_pending_remove(cmd); |
1898 | 1898 | ||
1899 | failed: | 1899 | failed: |
1900 | hci_dev_unlock_bh(hdev); | 1900 | hci_dev_unlock(hdev); |
1901 | hci_dev_put(hdev); | 1901 | hci_dev_put(hdev); |
1902 | 1902 | ||
1903 | return err; | 1903 | return err; |
@@ -1916,7 +1916,7 @@ static int stop_discovery(struct sock *sk, u16 index) | |||
1916 | return cmd_status(sk, index, MGMT_OP_STOP_DISCOVERY, | 1916 | return cmd_status(sk, index, MGMT_OP_STOP_DISCOVERY, |
1917 | MGMT_STATUS_INVALID_PARAMS); | 1917 | MGMT_STATUS_INVALID_PARAMS); |
1918 | 1918 | ||
1919 | hci_dev_lock_bh(hdev); | 1919 | hci_dev_lock(hdev); |
1920 | 1920 | ||
1921 | cmd = mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, hdev, NULL, 0); | 1921 | cmd = mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, hdev, NULL, 0); |
1922 | if (!cmd) { | 1922 | if (!cmd) { |
@@ -1929,7 +1929,7 @@ static int stop_discovery(struct sock *sk, u16 index) | |||
1929 | mgmt_pending_remove(cmd); | 1929 | mgmt_pending_remove(cmd); |
1930 | 1930 | ||
1931 | failed: | 1931 | failed: |
1932 | hci_dev_unlock_bh(hdev); | 1932 | hci_dev_unlock(hdev); |
1933 | hci_dev_put(hdev); | 1933 | hci_dev_put(hdev); |
1934 | 1934 | ||
1935 | return err; | 1935 | return err; |
@@ -1953,7 +1953,7 @@ static int block_device(struct sock *sk, u16 index, unsigned char *data, | |||
1953 | return cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE, | 1953 | return cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE, |
1954 | MGMT_STATUS_INVALID_PARAMS); | 1954 | MGMT_STATUS_INVALID_PARAMS); |
1955 | 1955 | ||
1956 | hci_dev_lock_bh(hdev); | 1956 | hci_dev_lock(hdev); |
1957 | 1957 | ||
1958 | err = hci_blacklist_add(hdev, &cp->bdaddr); | 1958 | err = hci_blacklist_add(hdev, &cp->bdaddr); |
1959 | if (err < 0) | 1959 | if (err < 0) |
@@ -1963,7 +1963,7 @@ static int block_device(struct sock *sk, u16 index, unsigned char *data, | |||
1963 | err = cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE, | 1963 | err = cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE, |
1964 | NULL, 0); | 1964 | NULL, 0); |
1965 | 1965 | ||
1966 | hci_dev_unlock_bh(hdev); | 1966 | hci_dev_unlock(hdev); |
1967 | hci_dev_put(hdev); | 1967 | hci_dev_put(hdev); |
1968 | 1968 | ||
1969 | return err; | 1969 | return err; |
@@ -1987,7 +1987,7 @@ static int unblock_device(struct sock *sk, u16 index, unsigned char *data, | |||
1987 | return cmd_status(sk, index, MGMT_OP_UNBLOCK_DEVICE, | 1987 | return cmd_status(sk, index, MGMT_OP_UNBLOCK_DEVICE, |
1988 | MGMT_STATUS_INVALID_PARAMS); | 1988 | MGMT_STATUS_INVALID_PARAMS); |
1989 | 1989 | ||
1990 | hci_dev_lock_bh(hdev); | 1990 | hci_dev_lock(hdev); |
1991 | 1991 | ||
1992 | err = hci_blacklist_del(hdev, &cp->bdaddr); | 1992 | err = hci_blacklist_del(hdev, &cp->bdaddr); |
1993 | 1993 | ||
@@ -1998,7 +1998,7 @@ static int unblock_device(struct sock *sk, u16 index, unsigned char *data, | |||
1998 | err = cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE, | 1998 | err = cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE, |
1999 | NULL, 0); | 1999 | NULL, 0); |
2000 | 2000 | ||
2001 | hci_dev_unlock_bh(hdev); | 2001 | hci_dev_unlock(hdev); |
2002 | hci_dev_put(hdev); | 2002 | hci_dev_put(hdev); |
2003 | 2003 | ||
2004 | return err; | 2004 | return err; |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index a324b009e34b..725e10d487f2 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -189,7 +189,7 @@ static int sco_connect(struct sock *sk) | |||
189 | if (!hdev) | 189 | if (!hdev) |
190 | return -EHOSTUNREACH; | 190 | return -EHOSTUNREACH; |
191 | 191 | ||
192 | hci_dev_lock_bh(hdev); | 192 | hci_dev_lock(hdev); |
193 | 193 | ||
194 | if (lmp_esco_capable(hdev) && !disable_esco) | 194 | if (lmp_esco_capable(hdev) && !disable_esco) |
195 | type = ESCO_LINK; | 195 | type = ESCO_LINK; |
@@ -225,7 +225,7 @@ static int sco_connect(struct sock *sk) | |||
225 | } | 225 | } |
226 | 226 | ||
227 | done: | 227 | done: |
228 | hci_dev_unlock_bh(hdev); | 228 | hci_dev_unlock(hdev); |
229 | hci_dev_put(hdev); | 229 | hci_dev_put(hdev); |
230 | return err; | 230 | return err; |
231 | } | 231 | } |