]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Clean up HCI state when doing power off
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 24 Feb 2014 12:52:22 +0000 (14:52 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 24 Feb 2014 19:10:36 +0000 (11:10 -0800)
commit6c8a0eca8a8815824332995b73090dc51db05761
treee7f68ab10e78959fd48965f13481927fb42a3ece
parent2c6a206a90b3726e164417e37b92ac58d84f6867
Bluetooth: Clean up HCI state when doing power off

To be friendly to user space and to behave well with controllers that
lack a proper internal power off procedure we should try to clean up as
much state as possible before requesting the HCI driver to power off.

This patch updates the power off procedure that's triggered by
mgmt_set_powered to clean any scan modes, stop LE scanning and
advertising and to disconnect any open connections.

The asynchronous cleanup procedure uses the HCI request framework,
however since HCI_Disconnect is only covered until its Command Status
event we need some extra tracking/waiting of disconnections. This is
done by monitoring when hci_conn_count() indicates that there are no
more connections.

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