Bluetooth: Fix L2CAP socket shutdown for LE connections

During the L2CAP socket shutdown, the LE connection is not terminated
as expected. This bug can be reproduced using l2test tool. Once the
LE connection is established, kill l2test and the LE connection will
not terminate.

This patch fixes hci_conn_disconnect function so it is able to
terminate LE connections.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Rename hci_acl_disconn

As this function basically sends the HCI Disconnect Command and it is
used to disconnect both ACL and LE links, renaming it to hci_disconnect
is more suitable.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: Don't schedule le_disable work if timeout <= 0.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: Always send hci command in hci_cancel_le_scan

This way we can use this helper even if there is no scanning timeout.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: Add new connection states

This patch adds two new connection states which will be used by
hci_conn to establish LE connection.

The BT_SCAN state means the controller should be scanning for LE
devices. Once the target device is found, the connection goes to
BT_DEV_FOUND state.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: Remove L2CAP connection timeout

This patch also don't set the l2cap channel timer if it is LE CID.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: Add hci_le_create_connection helper to hci_core.h

This patch adds hci_le_create_connection helper to hci_core.h so we
are able to use this helper outside hci_conn.c.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: LE connection handling

This patch implements the General Connection Establishment Procedure
described in Core spec. This way, the connect() system call now
implements this procedure instead of Direct Connection Establishment
Procedure.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: Remove unneeded check in hci_connect_le

This patch removes the unneeded check of hci_conn in BT_CONNECT
state. Since now the kernel implements the General connection
procedure, there is no way we hava more than one hci_conn in
BT_CONNECT state.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: If hcon is closed, stop scanning

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: Handle one LE connection at the time

For now, we are able to carry out one LE connection request at the
time. So, in order to guarantee there is only one connection attempt,
we should check for LE hci_conn objects in BT_OPEN state.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
WIP: Bluetooth: Initialize some hci_conn fields in hci_connent_le instead of hci_le_create_connection.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>