Bluetooth: Use hci_disconnect() for mgmt_disconnect_device()
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 18 Aug 2014 17:33:33 +0000 (20:33 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 8 Sep 2014 17:07:55 +0000 (19:07 +0200)
There's no reason to custom build the HCI_Disconnect command in the
Disconnect Device mgmt command handler. This patch updates the code to
use hci_disconnect() instead.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index d8c66663ade8cd77ee7894c9ac47c3e9c0fbf5a8..ab9521ae3c639fbb1ae9f5c8d497439402f51ccb 100644 (file)
@@ -2788,7 +2788,6 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
 {
        struct mgmt_cp_disconnect *cp = data;
        struct mgmt_rp_disconnect rp;
-       struct hci_cp_disconnect dc;
        struct pending_cmd *cmd;
        struct hci_conn *conn;
        int err;
@@ -2836,10 +2835,7 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
                goto failed;
        }
 
-       dc.handle = cpu_to_le16(conn->handle);
-       dc.reason = HCI_ERROR_REMOTE_USER_TERM;
-
-       err = hci_send_cmd(hdev, HCI_OP_DISCONNECT, sizeof(dc), &dc);
+       err = hci_disconnect(conn, HCI_ERROR_REMOTE_USER_TERM);
        if (err < 0)
                mgmt_pending_remove(cmd);