aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/btusb.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-10-10 12:47:55 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-10-10 16:08:02 -0400
commit014f7bc78738d86e156635d5ac239e199573df66 (patch)
tree0c3bcadafe9d9579f6ef875dda976ffedc0be1de /drivers/bluetooth/btusb.c
parentb145edcd1642d55a8eb7d08c954b815cb1478981 (diff)
Bluetooth: Use hci_conn_num() instead of direct connection hash access
When changing the alternate setting for the ISOC endpoints, use the hci_conn_num() helper function to count currently established SCO and eSCO connections and store the the value. This avoids direct access to the connection hash. In addition use the stored value instead accessing the connection hash over and over again. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/bluetooth/btusb.c')
-rw-r--r--drivers/bluetooth/btusb.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index f3dfc0a88fdc..faa429f7d8a1 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -774,7 +774,7 @@ static int btusb_send_frame(struct sk_buff *skb)
774 break; 774 break;
775 775
776 case HCI_SCODATA_PKT: 776 case HCI_SCODATA_PKT:
777 if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1) 777 if (!data->isoc_tx_ep || hci_conn_num(hdev, SCO_LINK) < 1)
778 return -ENODEV; 778 return -ENODEV;
779 779
780 urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC); 780 urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);
@@ -833,8 +833,8 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
833 833
834 BT_DBG("%s evt %d", hdev->name, evt); 834 BT_DBG("%s evt %d", hdev->name, evt);
835 835
836 if (hdev->conn_hash.sco_num != data->sco_num) { 836 if (hci_conn_num(hdev, SCO_LINK) != data->sco_num) {
837 data->sco_num = hdev->conn_hash.sco_num; 837 data->sco_num = hci_conn_num(hdev, SCO_LINK);
838 schedule_work(&data->work); 838 schedule_work(&data->work);
839 } 839 }
840} 840}
@@ -889,7 +889,7 @@ static void btusb_work(struct work_struct *work)
889 int new_alts; 889 int new_alts;
890 int err; 890 int err;
891 891
892 if (hdev->conn_hash.sco_num > 0) { 892 if (data->sco_num > 0) {
893 if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) { 893 if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
894 err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf); 894 err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf);
895 if (err < 0) { 895 if (err < 0) {
@@ -903,9 +903,9 @@ static void btusb_work(struct work_struct *work)
903 903
904 if (hdev->voice_setting & 0x0020) { 904 if (hdev->voice_setting & 0x0020) {
905 static const int alts[3] = { 2, 4, 5 }; 905 static const int alts[3] = { 2, 4, 5 };
906 new_alts = alts[hdev->conn_hash.sco_num - 1]; 906 new_alts = alts[data->sco_num - 1];
907 } else { 907 } else {
908 new_alts = hdev->conn_hash.sco_num; 908 new_alts = data->sco_num;
909 } 909 }
910 910
911 if (data->isoc_altsetting != new_alts) { 911 if (data->isoc_altsetting != new_alts) {