diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2013-03-05 13:37:41 -0500 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-03-08 08:40:25 -0500 |
commit | 01178cd420e0134ef3fb4da161ba6390c66913bf (patch) | |
tree | 7cc797bac72b75c87154616985a884209494a504 /net/bluetooth | |
parent | 24fd642ccb24c8b5732d7d7b5e98277507860b2a (diff) |
Bluetooth: Rename hci_request to hci_req_sync
We'll be introducing an async version of hci_request. To make things
clear it makes sense to rename the existing API to have a _sync suffix.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_core.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 4cb46c24a749..551df8a6f983 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -107,9 +107,9 @@ static void hci_req_cancel(struct hci_dev *hdev, int err) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | /* Execute request and wait for completion. */ | 109 | /* Execute request and wait for completion. */ |
110 | static int __hci_request(struct hci_dev *hdev, | 110 | static int __hci_req_sync(struct hci_dev *hdev, |
111 | void (*req)(struct hci_dev *hdev, unsigned long opt), | 111 | void (*req)(struct hci_dev *hdev, unsigned long opt), |
112 | unsigned long opt, __u32 timeout) | 112 | unsigned long opt, __u32 timeout) |
113 | { | 113 | { |
114 | DECLARE_WAITQUEUE(wait, current); | 114 | DECLARE_WAITQUEUE(wait, current); |
115 | int err = 0; | 115 | int err = 0; |
@@ -150,9 +150,9 @@ static int __hci_request(struct hci_dev *hdev, | |||
150 | return err; | 150 | return err; |
151 | } | 151 | } |
152 | 152 | ||
153 | static int hci_request(struct hci_dev *hdev, | 153 | static int hci_req_sync(struct hci_dev *hdev, |
154 | void (*req)(struct hci_dev *hdev, unsigned long opt), | 154 | void (*req)(struct hci_dev *hdev, unsigned long opt), |
155 | unsigned long opt, __u32 timeout) | 155 | unsigned long opt, __u32 timeout) |
156 | { | 156 | { |
157 | int ret; | 157 | int ret; |
158 | 158 | ||
@@ -161,7 +161,7 @@ static int hci_request(struct hci_dev *hdev, | |||
161 | 161 | ||
162 | /* Serialize all requests */ | 162 | /* Serialize all requests */ |
163 | hci_req_lock(hdev); | 163 | hci_req_lock(hdev); |
164 | ret = __hci_request(hdev, req, opt, timeout); | 164 | ret = __hci_req_sync(hdev, req, opt, timeout); |
165 | hci_req_unlock(hdev); | 165 | hci_req_unlock(hdev); |
166 | 166 | ||
167 | return ret; | 167 | return ret; |
@@ -556,7 +556,8 @@ int hci_inquiry(void __user *arg) | |||
556 | timeo = ir.length * msecs_to_jiffies(2000); | 556 | timeo = ir.length * msecs_to_jiffies(2000); |
557 | 557 | ||
558 | if (do_inquiry) { | 558 | if (do_inquiry) { |
559 | err = hci_request(hdev, hci_inq_req, (unsigned long)&ir, timeo); | 559 | err = hci_req_sync(hdev, hci_inq_req, (unsigned long) &ir, |
560 | timeo); | ||
560 | if (err < 0) | 561 | if (err < 0) |
561 | goto done; | 562 | goto done; |
562 | } | 563 | } |
@@ -737,7 +738,7 @@ int hci_dev_open(__u16 dev) | |||
737 | set_bit(HCI_INIT, &hdev->flags); | 738 | set_bit(HCI_INIT, &hdev->flags); |
738 | hdev->init_last_cmd = 0; | 739 | hdev->init_last_cmd = 0; |
739 | 740 | ||
740 | ret = __hci_request(hdev, hci_init_req, 0, HCI_INIT_TIMEOUT); | 741 | ret = __hci_req_sync(hdev, hci_init_req, 0, HCI_INIT_TIMEOUT); |
741 | 742 | ||
742 | clear_bit(HCI_INIT, &hdev->flags); | 743 | clear_bit(HCI_INIT, &hdev->flags); |
743 | } | 744 | } |
@@ -828,7 +829,7 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
828 | if (!test_bit(HCI_RAW, &hdev->flags) && | 829 | if (!test_bit(HCI_RAW, &hdev->flags) && |
829 | test_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks)) { | 830 | test_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks)) { |
830 | set_bit(HCI_INIT, &hdev->flags); | 831 | set_bit(HCI_INIT, &hdev->flags); |
831 | __hci_request(hdev, hci_reset_req, 0, HCI_CMD_TIMEOUT); | 832 | __hci_req_sync(hdev, hci_reset_req, 0, HCI_CMD_TIMEOUT); |
832 | clear_bit(HCI_INIT, &hdev->flags); | 833 | clear_bit(HCI_INIT, &hdev->flags); |
833 | } | 834 | } |
834 | 835 | ||
@@ -921,7 +922,7 @@ int hci_dev_reset(__u16 dev) | |||
921 | hdev->acl_cnt = 0; hdev->sco_cnt = 0; hdev->le_cnt = 0; | 922 | hdev->acl_cnt = 0; hdev->sco_cnt = 0; hdev->le_cnt = 0; |
922 | 923 | ||
923 | if (!test_bit(HCI_RAW, &hdev->flags)) | 924 | if (!test_bit(HCI_RAW, &hdev->flags)) |
924 | ret = __hci_request(hdev, hci_reset_req, 0, HCI_INIT_TIMEOUT); | 925 | ret = __hci_req_sync(hdev, hci_reset_req, 0, HCI_INIT_TIMEOUT); |
925 | 926 | ||
926 | done: | 927 | done: |
927 | hci_req_unlock(hdev); | 928 | hci_req_unlock(hdev); |
@@ -960,8 +961,8 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg) | |||
960 | 961 | ||
961 | switch (cmd) { | 962 | switch (cmd) { |
962 | case HCISETAUTH: | 963 | case HCISETAUTH: |
963 | err = hci_request(hdev, hci_auth_req, dr.dev_opt, | 964 | err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt, |
964 | HCI_INIT_TIMEOUT); | 965 | HCI_INIT_TIMEOUT); |
965 | break; | 966 | break; |
966 | 967 | ||
967 | case HCISETENCRYPT: | 968 | case HCISETENCRYPT: |
@@ -972,24 +973,24 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg) | |||
972 | 973 | ||
973 | if (!test_bit(HCI_AUTH, &hdev->flags)) { | 974 | if (!test_bit(HCI_AUTH, &hdev->flags)) { |
974 | /* Auth must be enabled first */ | 975 | /* Auth must be enabled first */ |
975 | err = hci_request(hdev, hci_auth_req, dr.dev_opt, | 976 | err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt, |
976 | HCI_INIT_TIMEOUT); | 977 | HCI_INIT_TIMEOUT); |
977 | if (err) | 978 | if (err) |
978 | break; | 979 | break; |
979 | } | 980 | } |
980 | 981 | ||
981 | err = hci_request(hdev, hci_encrypt_req, dr.dev_opt, | 982 | err = hci_req_sync(hdev, hci_encrypt_req, dr.dev_opt, |
982 | HCI_INIT_TIMEOUT); | 983 | HCI_INIT_TIMEOUT); |
983 | break; | 984 | break; |
984 | 985 | ||
985 | case HCISETSCAN: | 986 | case HCISETSCAN: |
986 | err = hci_request(hdev, hci_scan_req, dr.dev_opt, | 987 | err = hci_req_sync(hdev, hci_scan_req, dr.dev_opt, |
987 | HCI_INIT_TIMEOUT); | 988 | HCI_INIT_TIMEOUT); |
988 | break; | 989 | break; |
989 | 990 | ||
990 | case HCISETLINKPOL: | 991 | case HCISETLINKPOL: |
991 | err = hci_request(hdev, hci_linkpol_req, dr.dev_opt, | 992 | err = hci_req_sync(hdev, hci_linkpol_req, dr.dev_opt, |
992 | HCI_INIT_TIMEOUT); | 993 | HCI_INIT_TIMEOUT); |
993 | break; | 994 | break; |
994 | 995 | ||
995 | case HCISETLINKMODE: | 996 | case HCISETLINKMODE: |
@@ -1608,10 +1609,10 @@ static int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval, | |||
1608 | 1609 | ||
1609 | hci_req_lock(hdev); | 1610 | hci_req_lock(hdev); |
1610 | 1611 | ||
1611 | err = __hci_request(hdev, le_scan_param_req, (unsigned long) ¶m, | 1612 | err = __hci_req_sync(hdev, le_scan_param_req, (unsigned long) ¶m, |
1612 | timeo); | 1613 | timeo); |
1613 | if (!err) | 1614 | if (!err) |
1614 | err = __hci_request(hdev, le_scan_enable_req, 0, timeo); | 1615 | err = __hci_req_sync(hdev, le_scan_enable_req, 0, timeo); |
1615 | 1616 | ||
1616 | hci_req_unlock(hdev); | 1617 | hci_req_unlock(hdev); |
1617 | 1618 | ||