Bluetooth: Use GFP_KERNEL in mgmt_handlers

add_uuid and get_connections mgmt_handlers don't hold spinlock anymore
and they are executed by user threads running in kernel-mode. Thus, we
should use GFP_KERNEL for memory allocation instead of GFP_ATOMIC.

Signed-off-by: Andre Guedes <aguedespe@gmail.com>
Bluetooth: Use GFP_KERNEL in mgmt_pending_add

We are allowed to sleep in mgmt_pending_add, so we should use
GFP_KERNEL for memory allocations.

Signed-off-by: Andre Guedes <aguedespe@gmail.com>
Bluetooth: Use GFP_KERNEL in mgmt events functions

cmd_status, cmd_complete and mgmt_event functions are executed in
process context and they are not called inside atomic sections. Thus,
they should use GFP_KERNEL for memory allocation instead of GFP_ATOMIC.

Signed-off-by: Andre Guedes <aguedespe@gmail.com>
Bluetooth: Process unpair command if connect failed

Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org>
Bluetooth: Filter duplicated reports in LE scan

This patch enables filtering duplicated advertising reports during
LE scan.

Some LE devices advertise using very small intervals generating lots
of equal advertising report events to the host. Each event generates
a mgmt_device_found event which is copied to userspace.

Enabling this feature, duplicated advertising reports are filtered
at controller's link layer. This way, the controller doesn't wake up
the host to report duplicated advertising reports and, consequently,
less data is copied to userspace.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Trivial refactoring in __l2cap_chan_add

All cases in switch statement set chan->omtu to L2CAP_DEFAULT_MTU.
This patch moves the assigments to outside the switch statement.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Set MTU in l2cap_chan_set_defaults

Set the default values for imtu and omtu in l2cap_chan_set_defaults
helper function. This way, imtu and omtu default values are set
together with others L2CAP channel parameters.

This patch also removes imtu and omtu initialization from l2cap_sock_
init since they are now initialized in l2cap_chan_set_defaults.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
HID: User-space I/O driver support for HID subsystem

This driver allows to write I/O drivers in user-space and feed the input
into the HID subsystem. It operates on the same level as USB-HID and
Bluetooth-HID (HIDP). It does not provide support to write special HID
device drivers but rather provides support for user-space I/O devices to
feed their data into the kernel HID subsystem. The HID subsystem then
loads the HID device drivers for the device and provides input-devices
based on the user-space HID I/O device.

This driver register a new char-device (/dev/uhid). A user-space process
has to open this file for each device that it wants to provide to the
kernel. It can then use write/read to communicate with the UHID driver.
Both input and output data is sent with a uhid_event structure. The "type"
field of the structure specifies what kind of event is sent. There is a
file in Documentation/hid/ explaining the ABI and an example user-space
program that uses this interface in samples/uhid/.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>