Hi Marcel, On Nov 9, 2011, at 7:18 PM, Marcel Holtmann wrote: > Hi Andre, > >> This patch adds the helper function cmd_failed() to handle mgmt >> commands failures. This function sends the proper command status >> event and removes the command from the pending list. >> >> Signed-off-by: Andre Guedes <andre.guedes@xxxxxxxxxxxxx> >> --- >> net/bluetooth/mgmt.c | 53 +++++++++++++++++-------------------------------- >> 1 files changed, 19 insertions(+), 34 deletions(-) > > Acked-by: Marcel Holtmann <marcel@xxxxxxxxxxxx> > > <snip> > >> int mgmt_disconnect_failed(struct hci_dev *hdev) >> { >> - struct pending_cmd *cmd; >> - int err; >> - >> - cmd = mgmt_pending_find(MGMT_OP_DISCONNECT, hdev); >> - if (!cmd) >> - return -ENOENT; >> - >> - err = cmd_status(cmd->sk, hdev->id, MGMT_OP_DISCONNECT, EIO); >> - >> - mgmt_pending_remove(cmd); >> - >> - return err; >> + return cmd_failed(hdev, MGMT_OP_DISCONNECT, EIO); >> } > > So the only left-over question now is if we need to keep these empty > stub functions around or can just call cmd_failed directly. > > It might be actually cleaner to just call cmd_failed directly. I've asked myself the same question. If we wanna have hci_core layer calling cmd_failed() we need to include mgmt.h header so we have access to mgmt commands opcodes. BR, Andre -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html