Bluetooth: LE connection state machine

This patch implements a state machine for carrying out the general
connection establishment procedure described in Core spec.

The state machine should be used as follows: when the kernel
receives a new LE connection attempt, it should go to HCI_CONN_LE_
SCAN state, starting the passive LE scanning. Once the target remote
device is in-range, it should go to HCI_CONN_LE_FOUND, stopping the
ongoing LE scanning. After the LE scanning is disabled, it should go
to HCI_CONN_LE_INITIATE state where the LE connection is created.

This state machine will be used by the LE connection routine in
order to establish LE connections.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Add hci_conn helpers

This patch two hci_conn helpers for checking if we have a pending
connection for a given address/type and for checking if a device
we want to connect to was found.

These helper will be used by the LE connection routine in order to
establish LE connections.

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

In order to better support LE connection requirements, such as multiple
connections and re-connections, we should use the general connection
establishment procedure described in Core spec. Today, we use the direct
connection establishment procedure which has some limitations and,
therefore, requires extra connection management at user-space in order
to support LE connection requirements.

According to the spec, the general procedure is described as follows:
The host starts scanning for LE devices, once the device we want to
connect to is in-range, the host stops scanning and initiates a
connection. The procedure is terminated when the connection is
established or when the host terminates the procedure.

This patch changes the LE connection routine so we perform the general
procedure instead of the direct procedure.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Handle hci_conn timeout in BT_CONNECT

In order to properly cancel an ongoing LE connection attempt (hci_conn
in BT_CONNECT state), we need to check the current le_state.

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