summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorAbhishek Pandit-Subedi <abhishekpandit@chromium.org>2020-03-11 08:54:03 -0700
committerMarcel Holtmann <marcel@holtmann.org>2020-03-11 18:03:49 +0100
commit4867bd007d25a8dfd4ffc558534f7aec8b361789 (patch)
tree71455be1f23360b56b6db5aa130d9e9101215d72 /include/net
parentdd522a7429b07e4441871ae75ebbfcf53635bdd4 (diff)
downloadlinux-4867bd007d25a8dfd4ffc558534f7aec8b361789.tar.gz
linux-4867bd007d25a8dfd4ffc558534f7aec8b361789.tar.bz2
linux-4867bd007d25a8dfd4ffc558534f7aec8b361789.zip
Bluetooth: Pause discovery and advertising during suspend
To prevent spurious wake ups, we disable any discovery or advertising when we enter suspend and restore it when we exit suspend. While paused, we disable any management requests to modify discovery or advertising. Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/hci_core.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 2d58485d0335..d4e28773d378 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -91,6 +91,12 @@ struct discovery_state {
#define SUSPEND_NOTIFIER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
enum suspend_tasks {
+ SUSPEND_PAUSE_DISCOVERY,
+ SUSPEND_UNPAUSE_DISCOVERY,
+
+ SUSPEND_PAUSE_ADVERTISING,
+ SUSPEND_UNPAUSE_ADVERTISING,
+
SUSPEND_SCAN_DISABLE,
SUSPEND_SCAN_ENABLE,
SUSPEND_DISCONNECTING,
@@ -410,6 +416,11 @@ struct hci_dev {
struct discovery_state discovery;
+ int discovery_old_state;
+ bool discovery_paused;
+ int advertising_old_state;
+ bool advertising_paused;
+
struct notifier_block suspend_notifier;
struct work_struct suspend_prepare;
enum suspended_state suspend_state_next;