diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-11-10 08:54:39 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-11-10 15:05:41 -0500 |
commit | 37d9ef76c26092098e8fbd3fd540b7ac2181e6bf (patch) | |
tree | f46e360fc4d8b9d0a3e07b5fcf111d2be297fd8d /net/bluetooth/hci_event.c | |
parent | a8a1d19e9d00e2ec6f28b89133137390b1d293bd (diff) |
Bluetooth: Add status parameter to mgmt_disconnect response
Since disconnecting may fail the status needs to be communicated to user
space. This also updates the implementation to match the latest mgmt API
specification.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index bbfaaa8c018f..0d55d00596d8 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1605,27 +1605,27 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff | |||
1605 | 1605 | ||
1606 | BT_DBG("%s status %d", hdev->name, ev->status); | 1606 | BT_DBG("%s status %d", hdev->name, ev->status); |
1607 | 1607 | ||
1608 | if (ev->status) { | ||
1609 | hci_dev_lock(hdev); | ||
1610 | mgmt_disconnect_failed(hdev); | ||
1611 | hci_dev_unlock(hdev); | ||
1612 | return; | ||
1613 | } | ||
1614 | |||
1615 | hci_dev_lock(hdev); | 1608 | hci_dev_lock(hdev); |
1616 | 1609 | ||
1617 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); | 1610 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); |
1618 | if (!conn) | 1611 | if (!conn) |
1619 | goto unlock; | 1612 | goto unlock; |
1620 | 1613 | ||
1621 | conn->state = BT_CLOSED; | 1614 | if (ev->status == 0) |
1615 | conn->state = BT_CLOSED; | ||
1622 | 1616 | ||
1623 | if (conn->type == ACL_LINK || conn->type == LE_LINK) | 1617 | if (conn->type == ACL_LINK || conn->type == LE_LINK) { |
1624 | mgmt_disconnected(hdev, &conn->dst, conn->type, | 1618 | if (ev->status != 0) |
1619 | mgmt_disconnect_failed(hdev, &conn->dst, ev->status); | ||
1620 | else | ||
1621 | mgmt_disconnected(hdev, &conn->dst, conn->type, | ||
1625 | conn->dst_type); | 1622 | conn->dst_type); |
1623 | } | ||
1626 | 1624 | ||
1627 | hci_proto_disconn_cfm(conn, ev->reason); | 1625 | if (ev->status == 0) { |
1628 | hci_conn_del(conn); | 1626 | hci_proto_disconn_cfm(conn, ev->reason); |
1627 | hci_conn_del(conn); | ||
1628 | } | ||
1629 | 1629 | ||
1630 | unlock: | 1630 | unlock: |
1631 | hci_dev_unlock(hdev); | 1631 | hci_dev_unlock(hdev); |
@@ -2098,7 +2098,7 @@ static inline void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2098 | 2098 | ||
2099 | case HCI_OP_DISCONNECT: | 2099 | case HCI_OP_DISCONNECT: |
2100 | if (ev->status != 0) | 2100 | if (ev->status != 0) |
2101 | mgmt_disconnect_failed(hdev); | 2101 | mgmt_disconnect_failed(hdev, NULL, ev->status); |
2102 | break; | 2102 | break; |
2103 | 2103 | ||
2104 | case HCI_OP_LE_CREATE_CONN: | 2104 | case HCI_OP_LE_CREATE_CONN: |