Bluetooth: hci_sync: Convert MGMT_OP_READ_LOCAL_OOB_EXT_DATA
Uses existing *_sync functions mgmt-test paths: Read Local OOB Ext Data - Invalid index Read Local OOB Ext Data - Legacy pairing Read Local OOB Ext Data - Success SSP Read Local OOB Ext Data - Success SC Signed-off-by: Brian Gix <brian.gix@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Родитель
f892244b05
Коммит
177e77a30e
|
@ -7364,22 +7364,28 @@ unlock:
|
|||
return err;
|
||||
}
|
||||
|
||||
static void read_local_oob_ext_data_complete(struct hci_dev *hdev, u8 status,
|
||||
u16 opcode, struct sk_buff *skb)
|
||||
static void read_local_oob_ext_data_complete(struct hci_dev *hdev, void *data,
|
||||
int err)
|
||||
{
|
||||
const struct mgmt_cp_read_local_oob_ext_data *mgmt_cp;
|
||||
struct mgmt_rp_read_local_oob_ext_data *mgmt_rp;
|
||||
u8 *h192, *r192, *h256, *r256;
|
||||
struct mgmt_pending_cmd *cmd;
|
||||
struct mgmt_pending_cmd *cmd = data;
|
||||
struct sk_buff *skb = cmd->skb;
|
||||
u8 status = mgmt_status(err);
|
||||
u16 eir_len;
|
||||
int err;
|
||||
|
||||
if (!status) {
|
||||
if (!skb)
|
||||
status = MGMT_STATUS_FAILED;
|
||||
else if (IS_ERR(skb))
|
||||
status = mgmt_status(PTR_ERR(skb));
|
||||
else
|
||||
status = mgmt_status(skb->data[0]);
|
||||
}
|
||||
|
||||
bt_dev_dbg(hdev, "status %u", status);
|
||||
|
||||
cmd = pending_find(MGMT_OP_READ_LOCAL_OOB_EXT_DATA, hdev);
|
||||
if (!cmd)
|
||||
return;
|
||||
|
||||
mgmt_cp = cmd->param;
|
||||
|
||||
if (status) {
|
||||
|
@ -7390,7 +7396,7 @@ static void read_local_oob_ext_data_complete(struct hci_dev *hdev, u8 status,
|
|||
r192 = NULL;
|
||||
h256 = NULL;
|
||||
r256 = NULL;
|
||||
} else if (opcode == HCI_OP_READ_LOCAL_OOB_DATA) {
|
||||
} else if (!bredr_sc_enabled(hdev)) {
|
||||
struct hci_rp_read_local_oob_data *rp;
|
||||
|
||||
if (skb->len != sizeof(*rp)) {
|
||||
|
@ -7471,6 +7477,9 @@ send_rsp:
|
|||
mgmt_rp, sizeof(*mgmt_rp) + eir_len,
|
||||
HCI_MGMT_OOB_DATA_EVENTS, cmd->sk);
|
||||
done:
|
||||
if (skb && !IS_ERR(skb))
|
||||
kfree_skb(skb);
|
||||
|
||||
kfree(mgmt_rp);
|
||||
mgmt_pending_remove(cmd);
|
||||
}
|
||||
|
@ -7479,7 +7488,6 @@ static int read_local_ssp_oob_req(struct hci_dev *hdev, struct sock *sk,
|
|||
struct mgmt_cp_read_local_oob_ext_data *cp)
|
||||
{
|
||||
struct mgmt_pending_cmd *cmd;
|
||||
struct hci_request req;
|
||||
int err;
|
||||
|
||||
cmd = mgmt_pending_add(sk, MGMT_OP_READ_LOCAL_OOB_EXT_DATA, hdev,
|
||||
|
@ -7487,14 +7495,9 @@ static int read_local_ssp_oob_req(struct hci_dev *hdev, struct sock *sk,
|
|||
if (!cmd)
|
||||
return -ENOMEM;
|
||||
|
||||
hci_req_init(&req, hdev);
|
||||
err = hci_cmd_sync_queue(hdev, read_local_oob_data_sync, cmd,
|
||||
read_local_oob_ext_data_complete);
|
||||
|
||||
if (bredr_sc_enabled(hdev))
|
||||
hci_req_add(&req, HCI_OP_READ_LOCAL_OOB_EXT_DATA, 0, NULL);
|
||||
else
|
||||
hci_req_add(&req, HCI_OP_READ_LOCAL_OOB_DATA, 0, NULL);
|
||||
|
||||
err = hci_req_run_skb(&req, read_local_oob_ext_data_complete);
|
||||
if (err < 0) {
|
||||
mgmt_pending_remove(cmd);
|
||||
return err;
|
||||
|
|
Загрузка…
Ссылка в новой задаче