return NULL;
}
-static void mgmt_pending_remove(u16 opcode, int index)
+static void mgmt_pending_remove(struct pending_cmd *cmd)
{
- struct pending_cmd *cmd;
-
- cmd = mgmt_pending_find(opcode, index);
- if (cmd == NULL)
- return;
-
list_del(&cmd->list);
mgmt_pending_free(cmd);
}
err = hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
if (err < 0)
- mgmt_pending_remove(MGMT_OP_SET_DISCOVERABLE, dev_id);
+ mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
err = hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
if (err < 0)
- mgmt_pending_remove(MGMT_OP_SET_CONNECTABLE, dev_id);
+ mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
err = hci_send_cmd(hdev, HCI_OP_DISCONNECT, sizeof(dc), &dc);
if (err < 0)
- mgmt_pending_remove(MGMT_OP_DISCONNECT, dev_id);
+ mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
err = hci_send_cmd(hdev, HCI_OP_PIN_CODE_REPLY, sizeof(reply), &reply);
if (err < 0)
- mgmt_pending_remove(MGMT_OP_PIN_CODE_REPLY, dev_id);
+ mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
err = hci_send_cmd(hdev, HCI_OP_PIN_CODE_NEG_REPLY, sizeof(bdaddr_t),
&cp->bdaddr);
if (err < 0)
- mgmt_pending_remove(MGMT_OP_PIN_CODE_NEG_REPLY, dev_id);
+ mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
hci_conn_put(conn);
- list_del(&cmd->list);
- mgmt_pending_free(cmd);
+ mgmt_pending_remove(cmd);
}
static void pairing_complete_cb(struct hci_conn *conn, u8 status)
}
err = hci_send_cmd(hdev, hci_op, sizeof(cp->bdaddr), &cp->bdaddr);
- if (err < 0) {
- list_del(&cmd->list);
- mgmt_pending_free(cmd);
- }
+ if (err < 0)
+ mgmt_pending_remove(cmd);
failed:
hci_dev_unlock_bh(hdev);
*sk = cmd->sk;
sock_hold(*sk);
- list_del(&cmd->list);
- mgmt_pending_free(cmd);
+ mgmt_pending_remove(cmd);
}
int mgmt_disconnected(u16 index, bdaddr_t *bdaddr)
err = cmd_status(cmd->sk, MGMT_OP_DISCONNECT, EIO);
- list_del(&cmd->list);
- mgmt_pending_free(cmd);
+ mgmt_pending_remove(cmd);
return err;
}
err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_REPLY, &rp, sizeof(rp));
- list_del(&cmd->list);
- mgmt_pending_free(cmd);
+ mgmt_pending_remove(cmd);
return err;
}
err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY,
&rp, sizeof(rp));
- list_del(&cmd->list);
- mgmt_pending_free(cmd);
+ mgmt_pending_remove(cmd);
return err;
}
rp.status = status;
err = cmd_complete(cmd->sk, opcode, &rp, sizeof(rp));
- list_del(&cmd->list);
- mgmt_pending_free(cmd);
+ mgmt_pending_remove(cmd);
return err;
}