aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-06-11 04:13:07 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-06-11 23:07:05 -0400
commit5f246e890502fed387e0f959e2224ea680c03423 (patch)
treec53a010ed567f5780b96f22637e32a40a2372f67 /net/bluetooth
parent975b91bb17e70c0dc33ad07f16097106a9c2c6a2 (diff)
Bluetooth: Update HCI timeouts constants to use msecs_to_jiffies
The HCI constants are always used in form of jiffies. So just include the conversion from msecs in the define itself. This has the advantage of making the code where the timeout is used more readable and avoiding unnecessary conversions. The patch is similar to commit ba13ccd9 doing the same job for L2CAP Reported-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 471e4fb1b6e5..e91bf7e15666 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -690,12 +690,11 @@ int hci_dev_open(__u16 dev)
690 set_bit(HCI_INIT, &hdev->flags); 690 set_bit(HCI_INIT, &hdev->flags);
691 hdev->init_last_cmd = 0; 691 hdev->init_last_cmd = 0;
692 692
693 ret = __hci_request(hdev, hci_init_req, 0, 693 ret = __hci_request(hdev, hci_init_req, 0, HCI_INIT_TIMEOUT);
694 msecs_to_jiffies(HCI_INIT_TIMEOUT));
695 694
696 if (lmp_host_le_capable(hdev)) 695 if (lmp_host_le_capable(hdev))
697 ret = __hci_request(hdev, hci_le_init_req, 0, 696 ret = __hci_request(hdev, hci_le_init_req, 0,
698 msecs_to_jiffies(HCI_INIT_TIMEOUT)); 697 HCI_INIT_TIMEOUT);
699 698
700 clear_bit(HCI_INIT, &hdev->flags); 699 clear_bit(HCI_INIT, &hdev->flags);
701 } 700 }
@@ -782,8 +781,7 @@ static int hci_dev_do_close(struct hci_dev *hdev)
782 if (!test_bit(HCI_RAW, &hdev->flags) && 781 if (!test_bit(HCI_RAW, &hdev->flags) &&
783 test_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks)) { 782 test_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks)) {
784 set_bit(HCI_INIT, &hdev->flags); 783 set_bit(HCI_INIT, &hdev->flags);
785 __hci_request(hdev, hci_reset_req, 0, 784 __hci_request(hdev, hci_reset_req, 0, HCI_CMD_TIMEOUT);
786 msecs_to_jiffies(HCI_CMD_TIMEOUT));
787 clear_bit(HCI_INIT, &hdev->flags); 785 clear_bit(HCI_INIT, &hdev->flags);
788 } 786 }
789 787
@@ -872,8 +870,7 @@ int hci_dev_reset(__u16 dev)
872 hdev->acl_cnt = 0; hdev->sco_cnt = 0; hdev->le_cnt = 0; 870 hdev->acl_cnt = 0; hdev->sco_cnt = 0; hdev->le_cnt = 0;
873 871
874 if (!test_bit(HCI_RAW, &hdev->flags)) 872 if (!test_bit(HCI_RAW, &hdev->flags))
875 ret = __hci_request(hdev, hci_reset_req, 0, 873 ret = __hci_request(hdev, hci_reset_req, 0, HCI_INIT_TIMEOUT);
876 msecs_to_jiffies(HCI_INIT_TIMEOUT));
877 874
878done: 875done:
879 hci_req_unlock(hdev); 876 hci_req_unlock(hdev);
@@ -913,7 +910,7 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
913 switch (cmd) { 910 switch (cmd) {
914 case HCISETAUTH: 911 case HCISETAUTH:
915 err = hci_request(hdev, hci_auth_req, dr.dev_opt, 912 err = hci_request(hdev, hci_auth_req, dr.dev_opt,
916 msecs_to_jiffies(HCI_INIT_TIMEOUT)); 913 HCI_INIT_TIMEOUT);
917 break; 914 break;
918 915
919 case HCISETENCRYPT: 916 case HCISETENCRYPT:
@@ -925,23 +922,23 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
925 if (!test_bit(HCI_AUTH, &hdev->flags)) { 922 if (!test_bit(HCI_AUTH, &hdev->flags)) {
926 /* Auth must be enabled first */ 923 /* Auth must be enabled first */
927 err = hci_request(hdev, hci_auth_req, dr.dev_opt, 924 err = hci_request(hdev, hci_auth_req, dr.dev_opt,
928 msecs_to_jiffies(HCI_INIT_TIMEOUT)); 925 HCI_INIT_TIMEOUT);
929 if (err) 926 if (err)
930 break; 927 break;
931 } 928 }
932 929
933 err = hci_request(hdev, hci_encrypt_req, dr.dev_opt, 930 err = hci_request(hdev, hci_encrypt_req, dr.dev_opt,
934 msecs_to_jiffies(HCI_INIT_TIMEOUT)); 931 HCI_INIT_TIMEOUT);
935 break; 932 break;
936 933
937 case HCISETSCAN: 934 case HCISETSCAN:
938 err = hci_request(hdev, hci_scan_req, dr.dev_opt, 935 err = hci_request(hdev, hci_scan_req, dr.dev_opt,
939 msecs_to_jiffies(HCI_INIT_TIMEOUT)); 936 HCI_INIT_TIMEOUT);
940 break; 937 break;
941 938
942 case HCISETLINKPOL: 939 case HCISETLINKPOL:
943 err = hci_request(hdev, hci_linkpol_req, dr.dev_opt, 940 err = hci_request(hdev, hci_linkpol_req, dr.dev_opt,
944 msecs_to_jiffies(HCI_INIT_TIMEOUT)); 941 HCI_INIT_TIMEOUT);
945 break; 942 break;
946 943
947 case HCISETLINKMODE: 944 case HCISETLINKMODE:
@@ -2455,7 +2452,7 @@ static void __check_timeout(struct hci_dev *hdev, unsigned int cnt)
2455 /* ACL tx timeout must be longer than maximum 2452 /* ACL tx timeout must be longer than maximum
2456 * link supervision timeout (40.9 seconds) */ 2453 * link supervision timeout (40.9 seconds) */
2457 if (!cnt && time_after(jiffies, hdev->acl_last_tx + 2454 if (!cnt && time_after(jiffies, hdev->acl_last_tx +
2458 msecs_to_jiffies(HCI_ACL_TX_TIMEOUT))) 2455 HCI_ACL_TX_TIMEOUT))
2459 hci_link_tx_to(hdev, ACL_LINK); 2456 hci_link_tx_to(hdev, ACL_LINK);
2460 } 2457 }
2461} 2458}
@@ -2839,7 +2836,7 @@ static void hci_cmd_work(struct work_struct *work)
2839 del_timer(&hdev->cmd_timer); 2836 del_timer(&hdev->cmd_timer);
2840 else 2837 else
2841 mod_timer(&hdev->cmd_timer, 2838 mod_timer(&hdev->cmd_timer,
2842 jiffies + msecs_to_jiffies(HCI_CMD_TIMEOUT)); 2839 jiffies + HCI_CMD_TIMEOUT);
2843 } else { 2840 } else {
2844 skb_queue_head(&hdev->cmd_q, skb); 2841 skb_queue_head(&hdev->cmd_q, skb);
2845 queue_work(hdev->workqueue, &hdev->cmd_work); 2842 queue_work(hdev->workqueue, &hdev->cmd_work);