mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
Bluetooth: Add HCI status return parameter to hci_req_sync()
In some cases it may be important to get the exact HCI status rather than the converted HCI-to-errno value. Add an optional return parameter to the hci_req_sync() API to allow for this. Since there are no good HCI translation candidates for cancelation and timeout, use the "unknown" status code for those cases. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
51d7a94d56
commit
4ebeee2dff
4 changed files with 26 additions and 19 deletions
|
@ -768,14 +768,14 @@ static int __hci_init(struct hci_dev *hdev)
|
|||
{
|
||||
int err;
|
||||
|
||||
err = __hci_req_sync(hdev, hci_init1_req, 0, HCI_INIT_TIMEOUT);
|
||||
err = __hci_req_sync(hdev, hci_init1_req, 0, HCI_INIT_TIMEOUT, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (hci_dev_test_flag(hdev, HCI_SETUP))
|
||||
hci_debugfs_create_basic(hdev);
|
||||
|
||||
err = __hci_req_sync(hdev, hci_init2_req, 0, HCI_INIT_TIMEOUT);
|
||||
err = __hci_req_sync(hdev, hci_init2_req, 0, HCI_INIT_TIMEOUT, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@ -786,11 +786,11 @@ static int __hci_init(struct hci_dev *hdev)
|
|||
if (hdev->dev_type != HCI_BREDR)
|
||||
return 0;
|
||||
|
||||
err = __hci_req_sync(hdev, hci_init3_req, 0, HCI_INIT_TIMEOUT);
|
||||
err = __hci_req_sync(hdev, hci_init3_req, 0, HCI_INIT_TIMEOUT, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = __hci_req_sync(hdev, hci_init4_req, 0, HCI_INIT_TIMEOUT);
|
||||
err = __hci_req_sync(hdev, hci_init4_req, 0, HCI_INIT_TIMEOUT, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@ -846,7 +846,7 @@ static int __hci_unconf_init(struct hci_dev *hdev)
|
|||
if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
|
||||
return 0;
|
||||
|
||||
err = __hci_req_sync(hdev, hci_init0_req, 0, HCI_INIT_TIMEOUT);
|
||||
err = __hci_req_sync(hdev, hci_init0_req, 0, HCI_INIT_TIMEOUT, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ int hci_inquiry(void __user *arg)
|
|||
|
||||
if (do_inquiry) {
|
||||
err = hci_req_sync(hdev, hci_inq_req, (unsigned long) &ir,
|
||||
timeo);
|
||||
timeo, NULL);
|
||||
if (err < 0)
|
||||
goto done;
|
||||
|
||||
|
@ -1570,7 +1570,7 @@ int hci_dev_do_close(struct hci_dev *hdev)
|
|||
if (test_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks) &&
|
||||
!auto_off && !hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) {
|
||||
set_bit(HCI_INIT, &hdev->flags);
|
||||
__hci_req_sync(hdev, hci_reset_req, 0, HCI_CMD_TIMEOUT);
|
||||
__hci_req_sync(hdev, hci_reset_req, 0, HCI_CMD_TIMEOUT, NULL);
|
||||
clear_bit(HCI_INIT, &hdev->flags);
|
||||
}
|
||||
|
||||
|
@ -1667,7 +1667,7 @@ static int hci_dev_do_reset(struct hci_dev *hdev)
|
|||
atomic_set(&hdev->cmd_cnt, 1);
|
||||
hdev->acl_cnt = 0; hdev->sco_cnt = 0; hdev->le_cnt = 0;
|
||||
|
||||
ret = __hci_req_sync(hdev, hci_reset_req, 0, HCI_INIT_TIMEOUT);
|
||||
ret = __hci_req_sync(hdev, hci_reset_req, 0, HCI_INIT_TIMEOUT, NULL);
|
||||
|
||||
hci_req_sync_unlock(hdev);
|
||||
return ret;
|
||||
|
@ -1802,7 +1802,7 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
|
|||
switch (cmd) {
|
||||
case HCISETAUTH:
|
||||
err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt,
|
||||
HCI_INIT_TIMEOUT);
|
||||
HCI_INIT_TIMEOUT, NULL);
|
||||
break;
|
||||
|
||||
case HCISETENCRYPT:
|
||||
|
@ -1814,18 +1814,18 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
|
|||
if (!test_bit(HCI_AUTH, &hdev->flags)) {
|
||||
/* Auth must be enabled first */
|
||||
err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt,
|
||||
HCI_INIT_TIMEOUT);
|
||||
HCI_INIT_TIMEOUT, NULL);
|
||||
if (err)
|
||||
break;
|
||||
}
|
||||
|
||||
err = hci_req_sync(hdev, hci_encrypt_req, dr.dev_opt,
|
||||
HCI_INIT_TIMEOUT);
|
||||
HCI_INIT_TIMEOUT, NULL);
|
||||
break;
|
||||
|
||||
case HCISETSCAN:
|
||||
err = hci_req_sync(hdev, hci_scan_req, dr.dev_opt,
|
||||
HCI_INIT_TIMEOUT);
|
||||
HCI_INIT_TIMEOUT, NULL);
|
||||
|
||||
/* Ensure that the connectable and discoverable states
|
||||
* get correctly modified as this was a non-mgmt change.
|
||||
|
@ -1836,7 +1836,7 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
|
|||
|
||||
case HCISETLINKPOL:
|
||||
err = hci_req_sync(hdev, hci_linkpol_req, dr.dev_opt,
|
||||
HCI_INIT_TIMEOUT);
|
||||
HCI_INIT_TIMEOUT, NULL);
|
||||
break;
|
||||
|
||||
case HCISETLINKMODE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue