diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-01-11 16:50:44 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2015-01-12 04:16:31 -0500 |
commit | 1904a853fae40ee61bed7c231fc5bd2158984441 (patch) | |
tree | 04fd8e5a1cc1cf1814602d861f51ca8ece192308 /net/bluetooth | |
parent | bc6efeeeb5a2fa968532b9d666e8b7f823b1940f (diff) |
Bluetooth: Add opcode parameter to hci_req_complete_t callback
When hci_req_run() calls its provided complete function and one of the
HCI commands in the sequence fails, then provide the opcode of failing
command. In case of success HCI_OP_NOP is provided since all commands
completed.
This patch fixes the prototype of hci_req_complete_t and all its users.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_conn.c | 2 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 9 | ||||
-rw-r--r-- | net/bluetooth/hci_request.c | 3 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 44 |
4 files changed, 33 insertions, 25 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 75240aaca101..2e724e0b75b9 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -633,7 +633,7 @@ void hci_le_conn_failed(struct hci_conn *conn, u8 status) | |||
633 | mgmt_reenable_advertising(hdev); | 633 | mgmt_reenable_advertising(hdev); |
634 | } | 634 | } |
635 | 635 | ||
636 | static void create_le_conn_complete(struct hci_dev *hdev, u8 status) | 636 | static void create_le_conn_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
637 | { | 637 | { |
638 | struct hci_conn *conn; | 638 | struct hci_conn *conn; |
639 | 639 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index bc5486ea5411..ba0d1fdccbd9 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -141,7 +141,7 @@ static const struct file_operations dut_mode_fops = { | |||
141 | 141 | ||
142 | /* ---- HCI requests ---- */ | 142 | /* ---- HCI requests ---- */ |
143 | 143 | ||
144 | static void hci_req_sync_complete(struct hci_dev *hdev, u8 result) | 144 | static void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode) |
145 | { | 145 | { |
146 | BT_DBG("%s result 0x%2.2x", hdev->name, result); | 146 | BT_DBG("%s result 0x%2.2x", hdev->name, result); |
147 | 147 | ||
@@ -2754,7 +2754,7 @@ void hci_conn_params_clear_all(struct hci_dev *hdev) | |||
2754 | BT_DBG("All LE connection parameters were removed"); | 2754 | BT_DBG("All LE connection parameters were removed"); |
2755 | } | 2755 | } |
2756 | 2756 | ||
2757 | static void inquiry_complete(struct hci_dev *hdev, u8 status) | 2757 | static void inquiry_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
2758 | { | 2758 | { |
2759 | if (status) { | 2759 | if (status) { |
2760 | BT_ERR("Failed to start inquiry: status %d", status); | 2760 | BT_ERR("Failed to start inquiry: status %d", status); |
@@ -2766,7 +2766,8 @@ static void inquiry_complete(struct hci_dev *hdev, u8 status) | |||
2766 | } | 2766 | } |
2767 | } | 2767 | } |
2768 | 2768 | ||
2769 | static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status) | 2769 | static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status, |
2770 | u16 opcode) | ||
2770 | { | 2771 | { |
2771 | /* General inquiry access code (GIAC) */ | 2772 | /* General inquiry access code (GIAC) */ |
2772 | u8 lap[3] = { 0x33, 0x8b, 0x9e }; | 2773 | u8 lap[3] = { 0x33, 0x8b, 0x9e }; |
@@ -4159,7 +4160,7 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status) | |||
4159 | 4160 | ||
4160 | call_complete: | 4161 | call_complete: |
4161 | if (req_complete) | 4162 | if (req_complete) |
4162 | req_complete(hdev, status); | 4163 | req_complete(hdev, status, status ? opcode : HCI_OP_NOP); |
4163 | } | 4164 | } |
4164 | 4165 | ||
4165 | static void hci_rx_work(struct work_struct *work) | 4166 | static void hci_rx_work(struct work_struct *work) |
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 324c6418b17c..b59f92c6df0c 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c | |||
@@ -533,7 +533,8 @@ void __hci_update_background_scan(struct hci_request *req) | |||
533 | } | 533 | } |
534 | } | 534 | } |
535 | 535 | ||
536 | static void update_background_scan_complete(struct hci_dev *hdev, u8 status) | 536 | static void update_background_scan_complete(struct hci_dev *hdev, u8 status, |
537 | u16 opcode) | ||
537 | { | 538 | { |
538 | if (status) | 539 | if (status) |
539 | BT_DBG("HCI request failed to update background scanning: " | 540 | BT_DBG("HCI request failed to update background scanning: " |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 6b3f5537e441..e531da805923 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1251,7 +1251,7 @@ static int send_settings_rsp(struct sock *sk, u16 opcode, struct hci_dev *hdev) | |||
1251 | sizeof(settings)); | 1251 | sizeof(settings)); |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | static void clean_up_hci_complete(struct hci_dev *hdev, u8 status) | 1254 | static void clean_up_hci_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
1255 | { | 1255 | { |
1256 | BT_DBG("%s status 0x%02x", hdev->name, status); | 1256 | BT_DBG("%s status 0x%02x", hdev->name, status); |
1257 | 1257 | ||
@@ -1518,7 +1518,8 @@ static u8 mgmt_le_support(struct hci_dev *hdev) | |||
1518 | return MGMT_STATUS_SUCCESS; | 1518 | return MGMT_STATUS_SUCCESS; |
1519 | } | 1519 | } |
1520 | 1520 | ||
1521 | static void set_discoverable_complete(struct hci_dev *hdev, u8 status) | 1521 | static void set_discoverable_complete(struct hci_dev *hdev, u8 status, |
1522 | u16 opcode) | ||
1522 | { | 1523 | { |
1523 | struct pending_cmd *cmd; | 1524 | struct pending_cmd *cmd; |
1524 | struct mgmt_mode *cp; | 1525 | struct mgmt_mode *cp; |
@@ -1777,7 +1778,8 @@ static void write_fast_connectable(struct hci_request *req, bool enable) | |||
1777 | hci_req_add(req, HCI_OP_WRITE_PAGE_SCAN_TYPE, 1, &type); | 1778 | hci_req_add(req, HCI_OP_WRITE_PAGE_SCAN_TYPE, 1, &type); |
1778 | } | 1779 | } |
1779 | 1780 | ||
1780 | static void set_connectable_complete(struct hci_dev *hdev, u8 status) | 1781 | static void set_connectable_complete(struct hci_dev *hdev, u8 status, |
1782 | u16 opcode) | ||
1781 | { | 1783 | { |
1782 | struct pending_cmd *cmd; | 1784 | struct pending_cmd *cmd; |
1783 | struct mgmt_mode *cp; | 1785 | struct mgmt_mode *cp; |
@@ -2195,7 +2197,7 @@ unlock: | |||
2195 | return err; | 2197 | return err; |
2196 | } | 2198 | } |
2197 | 2199 | ||
2198 | static void le_enable_complete(struct hci_dev *hdev, u8 status) | 2200 | static void le_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
2199 | { | 2201 | { |
2200 | struct cmd_lookup match = { NULL, hdev }; | 2202 | struct cmd_lookup match = { NULL, hdev }; |
2201 | 2203 | ||
@@ -2385,7 +2387,7 @@ unlock: | |||
2385 | hci_dev_unlock(hdev); | 2387 | hci_dev_unlock(hdev); |
2386 | } | 2388 | } |
2387 | 2389 | ||
2388 | static void add_uuid_complete(struct hci_dev *hdev, u8 status) | 2390 | static void add_uuid_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
2389 | { | 2391 | { |
2390 | BT_DBG("status 0x%02x", status); | 2392 | BT_DBG("status 0x%02x", status); |
2391 | 2393 | ||
@@ -2464,7 +2466,7 @@ static bool enable_service_cache(struct hci_dev *hdev) | |||
2464 | return false; | 2466 | return false; |
2465 | } | 2467 | } |
2466 | 2468 | ||
2467 | static void remove_uuid_complete(struct hci_dev *hdev, u8 status) | 2469 | static void remove_uuid_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
2468 | { | 2470 | { |
2469 | BT_DBG("status 0x%02x", status); | 2471 | BT_DBG("status 0x%02x", status); |
2470 | 2472 | ||
@@ -2549,7 +2551,7 @@ unlock: | |||
2549 | return err; | 2551 | return err; |
2550 | } | 2552 | } |
2551 | 2553 | ||
2552 | static void set_class_complete(struct hci_dev *hdev, u8 status) | 2554 | static void set_class_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
2553 | { | 2555 | { |
2554 | BT_DBG("status 0x%02x", status); | 2556 | BT_DBG("status 0x%02x", status); |
2555 | 2557 | ||
@@ -3483,7 +3485,7 @@ static void update_name(struct hci_request *req) | |||
3483 | hci_req_add(req, HCI_OP_WRITE_LOCAL_NAME, sizeof(cp), &cp); | 3485 | hci_req_add(req, HCI_OP_WRITE_LOCAL_NAME, sizeof(cp), &cp); |
3484 | } | 3486 | } |
3485 | 3487 | ||
3486 | static void set_name_complete(struct hci_dev *hdev, u8 status) | 3488 | static void set_name_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
3487 | { | 3489 | { |
3488 | struct mgmt_cp_set_local_name *cp; | 3490 | struct mgmt_cp_set_local_name *cp; |
3489 | struct pending_cmd *cmd; | 3491 | struct pending_cmd *cmd; |
@@ -3834,7 +3836,8 @@ static bool trigger_discovery(struct hci_request *req, u8 *status) | |||
3834 | return true; | 3836 | return true; |
3835 | } | 3837 | } |
3836 | 3838 | ||
3837 | static void start_discovery_complete(struct hci_dev *hdev, u8 status) | 3839 | static void start_discovery_complete(struct hci_dev *hdev, u8 status, |
3840 | u16 opcode) | ||
3838 | { | 3841 | { |
3839 | struct pending_cmd *cmd; | 3842 | struct pending_cmd *cmd; |
3840 | unsigned long timeout; | 3843 | unsigned long timeout; |
@@ -4063,7 +4066,7 @@ failed: | |||
4063 | return err; | 4066 | return err; |
4064 | } | 4067 | } |
4065 | 4068 | ||
4066 | static void stop_discovery_complete(struct hci_dev *hdev, u8 status) | 4069 | static void stop_discovery_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
4067 | { | 4070 | { |
4068 | struct pending_cmd *cmd; | 4071 | struct pending_cmd *cmd; |
4069 | 4072 | ||
@@ -4289,7 +4292,8 @@ static int set_device_id(struct sock *sk, struct hci_dev *hdev, void *data, | |||
4289 | return err; | 4292 | return err; |
4290 | } | 4293 | } |
4291 | 4294 | ||
4292 | static void set_advertising_complete(struct hci_dev *hdev, u8 status) | 4295 | static void set_advertising_complete(struct hci_dev *hdev, u8 status, |
4296 | u16 opcode) | ||
4293 | { | 4297 | { |
4294 | struct cmd_lookup match = { NULL, hdev }; | 4298 | struct cmd_lookup match = { NULL, hdev }; |
4295 | 4299 | ||
@@ -4496,7 +4500,8 @@ static int set_scan_params(struct sock *sk, struct hci_dev *hdev, | |||
4496 | return err; | 4500 | return err; |
4497 | } | 4501 | } |
4498 | 4502 | ||
4499 | static void fast_connectable_complete(struct hci_dev *hdev, u8 status) | 4503 | static void fast_connectable_complete(struct hci_dev *hdev, u8 status, |
4504 | u16 opcode) | ||
4500 | { | 4505 | { |
4501 | struct pending_cmd *cmd; | 4506 | struct pending_cmd *cmd; |
4502 | 4507 | ||
@@ -4594,7 +4599,7 @@ unlock: | |||
4594 | return err; | 4599 | return err; |
4595 | } | 4600 | } |
4596 | 4601 | ||
4597 | static void set_bredr_complete(struct hci_dev *hdev, u8 status) | 4602 | static void set_bredr_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
4598 | { | 4603 | { |
4599 | struct pending_cmd *cmd; | 4604 | struct pending_cmd *cmd; |
4600 | 4605 | ||
@@ -5119,7 +5124,8 @@ static int conn_info_cmd_complete(struct pending_cmd *cmd, u8 status) | |||
5119 | return err; | 5124 | return err; |
5120 | } | 5125 | } |
5121 | 5126 | ||
5122 | static void conn_info_refresh_complete(struct hci_dev *hdev, u8 hci_status) | 5127 | static void conn_info_refresh_complete(struct hci_dev *hdev, u8 hci_status, |
5128 | u16 opcode) | ||
5123 | { | 5129 | { |
5124 | struct hci_cp_read_rssi *cp; | 5130 | struct hci_cp_read_rssi *cp; |
5125 | struct pending_cmd *cmd; | 5131 | struct pending_cmd *cmd; |
@@ -5326,7 +5332,7 @@ complete: | |||
5326 | return err; | 5332 | return err; |
5327 | } | 5333 | } |
5328 | 5334 | ||
5329 | static void get_clock_info_complete(struct hci_dev *hdev, u8 status) | 5335 | static void get_clock_info_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
5330 | { | 5336 | { |
5331 | struct hci_cp_read_clock *hci_cp; | 5337 | struct hci_cp_read_clock *hci_cp; |
5332 | struct pending_cmd *cmd; | 5338 | struct pending_cmd *cmd; |
@@ -5504,7 +5510,7 @@ static void device_added(struct sock *sk, struct hci_dev *hdev, | |||
5504 | mgmt_event(MGMT_EV_DEVICE_ADDED, hdev, &ev, sizeof(ev), sk); | 5510 | mgmt_event(MGMT_EV_DEVICE_ADDED, hdev, &ev, sizeof(ev), sk); |
5505 | } | 5511 | } |
5506 | 5512 | ||
5507 | static void add_device_complete(struct hci_dev *hdev, u8 status) | 5513 | static void add_device_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
5508 | { | 5514 | { |
5509 | struct pending_cmd *cmd; | 5515 | struct pending_cmd *cmd; |
5510 | 5516 | ||
@@ -5627,7 +5633,7 @@ static void device_removed(struct sock *sk, struct hci_dev *hdev, | |||
5627 | mgmt_event(MGMT_EV_DEVICE_REMOVED, hdev, &ev, sizeof(ev), sk); | 5633 | mgmt_event(MGMT_EV_DEVICE_REMOVED, hdev, &ev, sizeof(ev), sk); |
5628 | } | 5634 | } |
5629 | 5635 | ||
5630 | static void remove_device_complete(struct hci_dev *hdev, u8 status) | 5636 | static void remove_device_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
5631 | { | 5637 | { |
5632 | struct pending_cmd *cmd; | 5638 | struct pending_cmd *cmd; |
5633 | 5639 | ||
@@ -6205,7 +6211,7 @@ static void restart_le_actions(struct hci_request *req) | |||
6205 | __hci_update_background_scan(req); | 6211 | __hci_update_background_scan(req); |
6206 | } | 6212 | } |
6207 | 6213 | ||
6208 | static void powered_complete(struct hci_dev *hdev, u8 status) | 6214 | static void powered_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
6209 | { | 6215 | { |
6210 | struct cmd_lookup match = { NULL, hdev }; | 6216 | struct cmd_lookup match = { NULL, hdev }; |
6211 | 6217 | ||
@@ -7316,7 +7322,7 @@ void mgmt_discovering(struct hci_dev *hdev, u8 discovering) | |||
7316 | mgmt_event(MGMT_EV_DISCOVERING, hdev, &ev, sizeof(ev), NULL); | 7322 | mgmt_event(MGMT_EV_DISCOVERING, hdev, &ev, sizeof(ev), NULL); |
7317 | } | 7323 | } |
7318 | 7324 | ||
7319 | static void adv_enable_complete(struct hci_dev *hdev, u8 status) | 7325 | static void adv_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
7320 | { | 7326 | { |
7321 | BT_DBG("%s status %u", hdev->name, status); | 7327 | BT_DBG("%s status %u", hdev->name, status); |
7322 | } | 7328 | } |