Commit 177e77a3 authored by Brian Gix's avatar Brian Gix Committed by Marcel Holtmann

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: default avatarBrian Gix <brian.gix@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent f892244b
......@@ -7364,21 +7364,27 @@ static int set_public_address(struct sock *sk, struct hci_dev *hdev,
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;
bt_dev_dbg(hdev, "status %u", status);
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]);
}
cmd = pending_find(MGMT_OP_READ_LOCAL_OOB_EXT_DATA, hdev);
if (!cmd)
return;
bt_dev_dbg(hdev, "status %u", status);
mgmt_cp = cmd->param;
......@@ -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 @@ static void read_local_oob_ext_data_complete(struct hci_dev *hdev, u8 status,
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);
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_cmd_sync_queue(hdev, read_local_oob_data_sync, cmd,
read_local_oob_ext_data_complete);
err = hci_req_run_skb(&req, read_local_oob_ext_data_complete);
if (err < 0) {
mgmt_pending_remove(cmd);
return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment