aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bluetooth/mgmt.c108
1 files changed, 62 insertions, 46 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7bcdf61afe11..3d7dbdde7008 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -882,12 +882,15 @@ static u8 *create_uuid128_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len)
882 return ptr; 882 return ptr;
883} 883}
884 884
885static struct mgmt_pending_cmd *mgmt_pending_find(u16 opcode, 885static struct mgmt_pending_cmd *mgmt_pending_find(unsigned short channel,
886 u16 opcode,
886 struct hci_dev *hdev) 887 struct hci_dev *hdev)
887{ 888{
888 struct mgmt_pending_cmd *cmd; 889 struct mgmt_pending_cmd *cmd;
889 890
890 list_for_each_entry(cmd, &hdev->mgmt_pending, list) { 891 list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
892 if (hci_sock_get_channel(cmd->sk) != channel)
893 continue;
891 if (cmd->opcode == opcode) 894 if (cmd->opcode == opcode)
892 return cmd; 895 return cmd;
893 } 896 }
@@ -895,7 +898,13 @@ static struct mgmt_pending_cmd *mgmt_pending_find(u16 opcode,
895 return NULL; 898 return NULL;
896} 899}
897 900
898static struct mgmt_pending_cmd *mgmt_pending_find_data(u16 opcode, 901static struct mgmt_pending_cmd *pending_find(u16 opcode, struct hci_dev *hdev)
902{
903 return mgmt_pending_find(HCI_CHANNEL_CONTROL, opcode, hdev);
904}
905
906static struct mgmt_pending_cmd *mgmt_pending_find_data(unsigned short channel,
907 u16 opcode,
899 struct hci_dev *hdev, 908 struct hci_dev *hdev,
900 const void *data) 909 const void *data)
901{ 910{
@@ -911,6 +920,13 @@ static struct mgmt_pending_cmd *mgmt_pending_find_data(u16 opcode,
911 return NULL; 920 return NULL;
912} 921}
913 922
923static struct mgmt_pending_cmd *pending_find_data(u16 opcode,
924 struct hci_dev *hdev,
925 const void *data)
926{
927 return mgmt_pending_find_data(HCI_CHANNEL_CONTROL, opcode, hdev, data);
928}
929
914static u8 create_scan_rsp_data(struct hci_dev *hdev, u8 *ptr) 930static u8 create_scan_rsp_data(struct hci_dev *hdev, u8 *ptr)
915{ 931{
916 u8 ad_len = 0; 932 u8 ad_len = 0;
@@ -969,7 +985,7 @@ static u8 get_adv_discov_flags(struct hci_dev *hdev)
969 /* If there's a pending mgmt command the flags will not yet have 985 /* If there's a pending mgmt command the flags will not yet have
970 * their final values, so check for this first. 986 * their final values, so check for this first.
971 */ 987 */
972 cmd = mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, hdev); 988 cmd = pending_find(MGMT_OP_SET_DISCOVERABLE, hdev);
973 if (cmd) { 989 if (cmd) {
974 struct mgmt_mode *cp = cmd->param; 990 struct mgmt_mode *cp = cmd->param;
975 if (cp->val == 0x01) 991 if (cp->val == 0x01)
@@ -1177,7 +1193,7 @@ static bool get_connectable(struct hci_dev *hdev)
1177 /* If there's a pending mgmt command the flag will not yet have 1193 /* If there's a pending mgmt command the flag will not yet have
1178 * it's final value, so check for this first. 1194 * it's final value, so check for this first.
1179 */ 1195 */
1180 cmd = mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, hdev); 1196 cmd = pending_find(MGMT_OP_SET_CONNECTABLE, hdev);
1181 if (cmd) { 1197 if (cmd) {
1182 struct mgmt_mode *cp = cmd->param; 1198 struct mgmt_mode *cp = cmd->param;
1183 return cp->val; 1199 return cp->val;
@@ -1517,7 +1533,7 @@ static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data,
1517 1533
1518 hci_dev_lock(hdev); 1534 hci_dev_lock(hdev);
1519 1535
1520 if (mgmt_pending_find(MGMT_OP_SET_POWERED, hdev)) { 1536 if (pending_find(MGMT_OP_SET_POWERED, hdev)) {
1521 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_POWERED, 1537 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_POWERED,
1522 MGMT_STATUS_BUSY); 1538 MGMT_STATUS_BUSY);
1523 goto failed; 1539 goto failed;
@@ -1669,7 +1685,7 @@ static void set_discoverable_complete(struct hci_dev *hdev, u8 status,
1669 1685
1670 hci_dev_lock(hdev); 1686 hci_dev_lock(hdev);
1671 1687
1672 cmd = mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, hdev); 1688 cmd = pending_find(MGMT_OP_SET_DISCOVERABLE, hdev);
1673 if (!cmd) 1689 if (!cmd)
1674 goto unlock; 1690 goto unlock;
1675 1691
@@ -1754,8 +1770,8 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
1754 goto failed; 1770 goto failed;
1755 } 1771 }
1756 1772
1757 if (mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) || 1773 if (pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) ||
1758 mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) { 1774 pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) {
1759 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, 1775 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE,
1760 MGMT_STATUS_BUSY); 1776 MGMT_STATUS_BUSY);
1761 goto failed; 1777 goto failed;
@@ -1926,7 +1942,7 @@ static void set_connectable_complete(struct hci_dev *hdev, u8 status,
1926 1942
1927 hci_dev_lock(hdev); 1943 hci_dev_lock(hdev);
1928 1944
1929 cmd = mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, hdev); 1945 cmd = pending_find(MGMT_OP_SET_CONNECTABLE, hdev);
1930 if (!cmd) 1946 if (!cmd)
1931 goto unlock; 1947 goto unlock;
1932 1948
@@ -2021,8 +2037,8 @@ static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data,
2021 goto failed; 2037 goto failed;
2022 } 2038 }
2023 2039
2024 if (mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) || 2040 if (pending_find(MGMT_OP_SET_DISCOVERABLE, hdev) ||
2025 mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) { 2041 pending_find(MGMT_OP_SET_CONNECTABLE, hdev)) {
2026 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE, 2042 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE,
2027 MGMT_STATUS_BUSY); 2043 MGMT_STATUS_BUSY);
2028 goto failed; 2044 goto failed;
@@ -2161,7 +2177,7 @@ static int set_link_security(struct sock *sk, struct hci_dev *hdev, void *data,
2161 goto failed; 2177 goto failed;
2162 } 2178 }
2163 2179
2164 if (mgmt_pending_find(MGMT_OP_SET_LINK_SECURITY, hdev)) { 2180 if (pending_find(MGMT_OP_SET_LINK_SECURITY, hdev)) {
2165 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY, 2181 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY,
2166 MGMT_STATUS_BUSY); 2182 MGMT_STATUS_BUSY);
2167 goto failed; 2183 goto failed;
@@ -2240,7 +2256,7 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2240 goto failed; 2256 goto failed;
2241 } 2257 }
2242 2258
2243 if (mgmt_pending_find(MGMT_OP_SET_SSP, hdev)) { 2259 if (pending_find(MGMT_OP_SET_SSP, hdev)) {
2244 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, 2260 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
2245 MGMT_STATUS_BUSY); 2261 MGMT_STATUS_BUSY);
2246 goto failed; 2262 goto failed;
@@ -2299,7 +2315,7 @@ static int set_hs(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2299 2315
2300 hci_dev_lock(hdev); 2316 hci_dev_lock(hdev);
2301 2317
2302 if (mgmt_pending_find(MGMT_OP_SET_SSP, hdev)) { 2318 if (pending_find(MGMT_OP_SET_SSP, hdev)) {
2303 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, 2319 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
2304 MGMT_STATUS_BUSY); 2320 MGMT_STATUS_BUSY);
2305 goto unlock; 2321 goto unlock;
@@ -2421,8 +2437,8 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2421 goto unlock; 2437 goto unlock;
2422 } 2438 }
2423 2439
2424 if (mgmt_pending_find(MGMT_OP_SET_LE, hdev) || 2440 if (pending_find(MGMT_OP_SET_LE, hdev) ||
2425 mgmt_pending_find(MGMT_OP_SET_ADVERTISING, hdev)) { 2441 pending_find(MGMT_OP_SET_ADVERTISING, hdev)) {
2426 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE, 2442 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE,
2427 MGMT_STATUS_BUSY); 2443 MGMT_STATUS_BUSY);
2428 goto unlock; 2444 goto unlock;
@@ -2506,7 +2522,7 @@ static void mgmt_class_complete(struct hci_dev *hdev, u16 mgmt_op, u8 status)
2506 2522
2507 hci_dev_lock(hdev); 2523 hci_dev_lock(hdev);
2508 2524
2509 cmd = mgmt_pending_find(mgmt_op, hdev); 2525 cmd = pending_find(mgmt_op, hdev);
2510 if (!cmd) 2526 if (!cmd)
2511 goto unlock; 2527 goto unlock;
2512 2528
@@ -3000,7 +3016,7 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
3000 goto failed; 3016 goto failed;
3001 } 3017 }
3002 3018
3003 if (mgmt_pending_find(MGMT_OP_DISCONNECT, hdev)) { 3019 if (pending_find(MGMT_OP_DISCONNECT, hdev)) {
3004 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT, 3020 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT,
3005 MGMT_STATUS_BUSY, &rp, sizeof(rp)); 3021 MGMT_STATUS_BUSY, &rp, sizeof(rp));
3006 goto failed; 3022 goto failed;
@@ -3464,7 +3480,7 @@ static int cancel_pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3464 goto unlock; 3480 goto unlock;
3465 } 3481 }
3466 3482
3467 cmd = mgmt_pending_find(MGMT_OP_PAIR_DEVICE, hdev); 3483 cmd = pending_find(MGMT_OP_PAIR_DEVICE, hdev);
3468 if (!cmd) { 3484 if (!cmd) {
3469 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE, 3485 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_CANCEL_PAIR_DEVICE,
3470 MGMT_STATUS_INVALID_PARAMS); 3486 MGMT_STATUS_INVALID_PARAMS);
@@ -3642,7 +3658,7 @@ static void set_name_complete(struct hci_dev *hdev, u8 status, u16 opcode)
3642 3658
3643 hci_dev_lock(hdev); 3659 hci_dev_lock(hdev);
3644 3660
3645 cmd = mgmt_pending_find(MGMT_OP_SET_LOCAL_NAME, hdev); 3661 cmd = pending_find(MGMT_OP_SET_LOCAL_NAME, hdev);
3646 if (!cmd) 3662 if (!cmd)
3647 goto unlock; 3663 goto unlock;
3648 3664
@@ -3752,7 +3768,7 @@ static int read_local_oob_data(struct sock *sk, struct hci_dev *hdev,
3752 goto unlock; 3768 goto unlock;
3753 } 3769 }
3754 3770
3755 if (mgmt_pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, hdev)) { 3771 if (pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, hdev)) {
3756 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA, 3772 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_DATA,
3757 MGMT_STATUS_BUSY); 3773 MGMT_STATUS_BUSY);
3758 goto unlock; 3774 goto unlock;
@@ -4065,9 +4081,9 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status,
4065 4081
4066 hci_dev_lock(hdev); 4082 hci_dev_lock(hdev);
4067 4083
4068 cmd = mgmt_pending_find(MGMT_OP_START_DISCOVERY, hdev); 4084 cmd = pending_find(MGMT_OP_START_DISCOVERY, hdev);
4069 if (!cmd) 4085 if (!cmd)
4070 cmd = mgmt_pending_find(MGMT_OP_START_SERVICE_DISCOVERY, hdev); 4086 cmd = pending_find(MGMT_OP_START_SERVICE_DISCOVERY, hdev);
4071 4087
4072 if (cmd) { 4088 if (cmd) {
4073 cmd->cmd_complete(cmd, mgmt_status(status)); 4089 cmd->cmd_complete(cmd, mgmt_status(status));
@@ -4322,7 +4338,7 @@ static void stop_discovery_complete(struct hci_dev *hdev, u8 status, u16 opcode)
4322 4338
4323 hci_dev_lock(hdev); 4339 hci_dev_lock(hdev);
4324 4340
4325 cmd = mgmt_pending_find(MGMT_OP_STOP_DISCOVERY, hdev); 4341 cmd = pending_find(MGMT_OP_STOP_DISCOVERY, hdev);
4326 if (cmd) { 4342 if (cmd) {
4327 cmd->cmd_complete(cmd, mgmt_status(status)); 4343 cmd->cmd_complete(cmd, mgmt_status(status));
4328 mgmt_pending_remove(cmd); 4344 mgmt_pending_remove(cmd);
@@ -4631,8 +4647,8 @@ static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data,
4631 goto unlock; 4647 goto unlock;
4632 } 4648 }
4633 4649
4634 if (mgmt_pending_find(MGMT_OP_SET_ADVERTISING, hdev) || 4650 if (pending_find(MGMT_OP_SET_ADVERTISING, hdev) ||
4635 mgmt_pending_find(MGMT_OP_SET_LE, hdev)) { 4651 pending_find(MGMT_OP_SET_LE, hdev)) {
4636 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, 4652 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING,
4637 MGMT_STATUS_BUSY); 4653 MGMT_STATUS_BUSY);
4638 goto unlock; 4654 goto unlock;
@@ -4775,7 +4791,7 @@ static void fast_connectable_complete(struct hci_dev *hdev, u8 status,
4775 4791
4776 hci_dev_lock(hdev); 4792 hci_dev_lock(hdev);
4777 4793
4778 cmd = mgmt_pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev); 4794 cmd = pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev);
4779 if (!cmd) 4795 if (!cmd)
4780 goto unlock; 4796 goto unlock;
4781 4797
@@ -4821,7 +4837,7 @@ static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev,
4821 4837
4822 hci_dev_lock(hdev); 4838 hci_dev_lock(hdev);
4823 4839
4824 if (mgmt_pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev)) { 4840 if (pending_find(MGMT_OP_SET_FAST_CONNECTABLE, hdev)) {
4825 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, 4841 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
4826 MGMT_STATUS_BUSY); 4842 MGMT_STATUS_BUSY);
4827 goto unlock; 4843 goto unlock;
@@ -4873,7 +4889,7 @@ static void set_bredr_complete(struct hci_dev *hdev, u8 status, u16 opcode)
4873 4889
4874 hci_dev_lock(hdev); 4890 hci_dev_lock(hdev);
4875 4891
4876 cmd = mgmt_pending_find(MGMT_OP_SET_BREDR, hdev); 4892 cmd = pending_find(MGMT_OP_SET_BREDR, hdev);
4877 if (!cmd) 4893 if (!cmd)
4878 goto unlock; 4894 goto unlock;
4879 4895
@@ -4973,7 +4989,7 @@ static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
4973 } 4989 }
4974 } 4990 }
4975 4991
4976 if (mgmt_pending_find(MGMT_OP_SET_BREDR, hdev)) { 4992 if (pending_find(MGMT_OP_SET_BREDR, hdev)) {
4977 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR, 4993 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_BREDR,
4978 MGMT_STATUS_BUSY); 4994 MGMT_STATUS_BUSY);
4979 goto unlock; 4995 goto unlock;
@@ -5018,7 +5034,7 @@ static void sc_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode)
5018 5034
5019 hci_dev_lock(hdev); 5035 hci_dev_lock(hdev);
5020 5036
5021 cmd = mgmt_pending_find(MGMT_OP_SET_SECURE_CONN, hdev); 5037 cmd = pending_find(MGMT_OP_SET_SECURE_CONN, hdev);
5022 if (!cmd) 5038 if (!cmd)
5023 goto unlock; 5039 goto unlock;
5024 5040
@@ -5109,7 +5125,7 @@ static int set_secure_conn(struct sock *sk, struct hci_dev *hdev,
5109 goto failed; 5125 goto failed;
5110 } 5126 }
5111 5127
5112 if (mgmt_pending_find(MGMT_OP_SET_SECURE_CONN, hdev)) { 5128 if (pending_find(MGMT_OP_SET_SECURE_CONN, hdev)) {
5113 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN, 5129 err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_SECURE_CONN,
5114 MGMT_STATUS_BUSY); 5130 MGMT_STATUS_BUSY);
5115 goto failed; 5131 goto failed;
@@ -5502,7 +5518,7 @@ static void conn_info_refresh_complete(struct hci_dev *hdev, u8 hci_status,
5502 goto unlock; 5518 goto unlock;
5503 } 5519 }
5504 5520
5505 cmd = mgmt_pending_find_data(MGMT_OP_GET_CONN_INFO, hdev, conn); 5521 cmd = pending_find_data(MGMT_OP_GET_CONN_INFO, hdev, conn);
5506 if (!cmd) 5522 if (!cmd)
5507 goto unlock; 5523 goto unlock;
5508 5524
@@ -5555,7 +5571,7 @@ static int get_conn_info(struct sock *sk, struct hci_dev *hdev, void *data,
5555 goto unlock; 5571 goto unlock;
5556 } 5572 }
5557 5573
5558 if (mgmt_pending_find_data(MGMT_OP_GET_CONN_INFO, hdev, conn)) { 5574 if (pending_find_data(MGMT_OP_GET_CONN_INFO, hdev, conn)) {
5559 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO, 5575 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO,
5560 MGMT_STATUS_BUSY, &rp, sizeof(rp)); 5576 MGMT_STATUS_BUSY, &rp, sizeof(rp));
5561 goto unlock; 5577 goto unlock;
@@ -5691,7 +5707,7 @@ static void get_clock_info_complete(struct hci_dev *hdev, u8 status, u16 opcode)
5691 conn = NULL; 5707 conn = NULL;
5692 } 5708 }
5693 5709
5694 cmd = mgmt_pending_find_data(MGMT_OP_GET_CLOCK_INFO, hdev, conn); 5710 cmd = pending_find_data(MGMT_OP_GET_CLOCK_INFO, hdev, conn);
5695 if (!cmd) 5711 if (!cmd)
5696 goto unlock; 5712 goto unlock;
5697 5713
@@ -5857,7 +5873,7 @@ static void add_device_complete(struct hci_dev *hdev, u8 status, u16 opcode)
5857 5873
5858 hci_dev_lock(hdev); 5874 hci_dev_lock(hdev);
5859 5875
5860 cmd = mgmt_pending_find(MGMT_OP_ADD_DEVICE, hdev); 5876 cmd = pending_find(MGMT_OP_ADD_DEVICE, hdev);
5861 if (!cmd) 5877 if (!cmd)
5862 goto unlock; 5878 goto unlock;
5863 5879
@@ -5980,7 +5996,7 @@ static void remove_device_complete(struct hci_dev *hdev, u8 status, u16 opcode)
5980 5996
5981 hci_dev_lock(hdev); 5997 hci_dev_lock(hdev);
5982 5998
5983 cmd = mgmt_pending_find(MGMT_OP_REMOVE_DEVICE, hdev); 5999 cmd = pending_find(MGMT_OP_REMOVE_DEVICE, hdev);
5984 if (!cmd) 6000 if (!cmd)
5985 goto unlock; 6001 goto unlock;
5986 6002
@@ -6937,7 +6953,7 @@ void mgmt_set_powered_failed(struct hci_dev *hdev, int err)
6937 struct mgmt_pending_cmd *cmd; 6953 struct mgmt_pending_cmd *cmd;
6938 u8 status; 6954 u8 status;
6939 6955
6940 cmd = mgmt_pending_find(MGMT_OP_SET_POWERED, hdev); 6956 cmd = pending_find(MGMT_OP_SET_POWERED, hdev);
6941 if (!cmd) 6957 if (!cmd)
6942 return; 6958 return;
6943 6959
@@ -7202,7 +7218,7 @@ bool mgmt_powering_down(struct hci_dev *hdev)
7202 struct mgmt_pending_cmd *cmd; 7218 struct mgmt_pending_cmd *cmd;
7203 struct mgmt_mode *cp; 7219 struct mgmt_mode *cp;
7204 7220
7205 cmd = mgmt_pending_find(MGMT_OP_SET_POWERED, hdev); 7221 cmd = pending_find(MGMT_OP_SET_POWERED, hdev);
7206 if (!cmd) 7222 if (!cmd)
7207 return false; 7223 return false;
7208 7224
@@ -7259,7 +7275,7 @@ void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
7259 mgmt_pending_foreach(MGMT_OP_UNPAIR_DEVICE, hdev, unpair_device_rsp, 7275 mgmt_pending_foreach(MGMT_OP_UNPAIR_DEVICE, hdev, unpair_device_rsp,
7260 hdev); 7276 hdev);
7261 7277
7262 cmd = mgmt_pending_find(MGMT_OP_DISCONNECT, hdev); 7278 cmd = pending_find(MGMT_OP_DISCONNECT, hdev);
7263 if (!cmd) 7279 if (!cmd)
7264 return; 7280 return;
7265 7281
@@ -7311,7 +7327,7 @@ void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
7311{ 7327{
7312 struct mgmt_pending_cmd *cmd; 7328 struct mgmt_pending_cmd *cmd;
7313 7329
7314 cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_REPLY, hdev); 7330 cmd = pending_find(MGMT_OP_PIN_CODE_REPLY, hdev);
7315 if (!cmd) 7331 if (!cmd)
7316 return; 7332 return;
7317 7333
@@ -7324,7 +7340,7 @@ void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
7324{ 7340{
7325 struct mgmt_pending_cmd *cmd; 7341 struct mgmt_pending_cmd *cmd;
7326 7342
7327 cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, hdev); 7343 cmd = pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, hdev);
7328 if (!cmd) 7344 if (!cmd)
7329 return; 7345 return;
7330 7346
@@ -7369,7 +7385,7 @@ static int user_pairing_resp_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
7369{ 7385{
7370 struct mgmt_pending_cmd *cmd; 7386 struct mgmt_pending_cmd *cmd;
7371 7387
7372 cmd = mgmt_pending_find(opcode, hdev); 7388 cmd = pending_find(opcode, hdev);
7373 if (!cmd) 7389 if (!cmd)
7374 return -ENOENT; 7390 return -ENOENT;
7375 7391
@@ -7580,14 +7596,14 @@ void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status)
7580 memcpy(ev.name, name, HCI_MAX_NAME_LENGTH); 7596 memcpy(ev.name, name, HCI_MAX_NAME_LENGTH);
7581 memcpy(ev.short_name, hdev->short_name, HCI_MAX_SHORT_NAME_LENGTH); 7597 memcpy(ev.short_name, hdev->short_name, HCI_MAX_SHORT_NAME_LENGTH);
7582 7598
7583 cmd = mgmt_pending_find(MGMT_OP_SET_LOCAL_NAME, hdev); 7599 cmd = pending_find(MGMT_OP_SET_LOCAL_NAME, hdev);
7584 if (!cmd) { 7600 if (!cmd) {
7585 memcpy(hdev->dev_name, name, sizeof(hdev->dev_name)); 7601 memcpy(hdev->dev_name, name, sizeof(hdev->dev_name));
7586 7602
7587 /* If this is a HCI command related to powering on the 7603 /* If this is a HCI command related to powering on the
7588 * HCI dev don't send any mgmt signals. 7604 * HCI dev don't send any mgmt signals.
7589 */ 7605 */
7590 if (mgmt_pending_find(MGMT_OP_SET_POWERED, hdev)) 7606 if (pending_find(MGMT_OP_SET_POWERED, hdev))
7591 return; 7607 return;
7592 } 7608 }
7593 7609
@@ -7603,7 +7619,7 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
7603 7619
7604 BT_DBG("%s status %u", hdev->name, status); 7620 BT_DBG("%s status %u", hdev->name, status);
7605 7621
7606 cmd = mgmt_pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, hdev); 7622 cmd = pending_find(MGMT_OP_READ_LOCAL_OOB_DATA, hdev);
7607 if (!cmd) 7623 if (!cmd)
7608 return; 7624 return;
7609 7625