diff mbox series

[2/2] Bluetooth: hci_sync: Cancel AdvMonitor interleave scan when suspend

Message ID 20220803132319.2.I27d3502a0851c75c0c31fb7fea9b09644d54d81d@changeid (mailing list archive)
State New, archived
Headers show
Series [1/2] Bluetooth: Disable AdvMonitor SamplingPeriod while active scan | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/subjectprefix success PASS

Commit Message

Manish Mandlik Aug. 3, 2022, 8:24 p.m. UTC
Cancel interleaved scanning for advertisement monitor when suspend.

Fixes: 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")

Signed-off-by: Manish Mandlik <mmandlik@google.com>
Reviewed-by: Miao-chen Chou <mcchou@google.com>
---

 net/bluetooth/hci_sync.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Luiz Augusto von Dentz Aug. 3, 2022, 9:32 p.m. UTC | #1
Hi Manish,

On Wed, Aug 3, 2022 at 1:24 PM Manish Mandlik <mmandlik@google.com> wrote:
>
> Cancel interleaved scanning for advertisement monitor when suspend.
>
> Fixes: 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
>
> Signed-off-by: Manish Mandlik <mmandlik@google.com>
> Reviewed-by: Miao-chen Chou <mcchou@google.com>
> ---
>
>  net/bluetooth/hci_sync.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index cb0c219ebe1c..33d2221b2bc4 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -1721,6 +1721,9 @@ static bool is_interleave_scanning(struct hci_dev *hdev)
>
>  static void cancel_interleave_scan(struct hci_dev *hdev)
>  {
> +       if (!is_interleave_scanning(hdev))
> +               return;
> +
>         bt_dev_dbg(hdev, "cancelling interleave scan");
>
>         cancel_delayed_work_sync(&hdev->interleave_scan);
> @@ -5288,6 +5291,9 @@ int hci_suspend_sync(struct hci_dev *hdev)
>         /* Pause other advertisements */
>         hci_pause_advertising_sync(hdev);
>
> +       /* Cancel interleaved scan */
> +       cancel_interleave_scan(hdev);
> +
>         /* Suspend monitor filters */
>         hci_suspend_monitor_sync(hdev);
>
> --
> 2.37.1.455.g008518b4e5-goog

This will likely conflict with the following changes:

https://patchwork.kernel.org/project/bluetooth/patch/20220801171505.1271059-6-brian.gix@intel.com/

Also I think this code shall be part of hci_scan_disable_sync so
scanning_paused apply to all scanning including interleave_scanning
and we most likely need a mgmt-tester that exercise this since
apparently that is not being tested, @Gix, Brian can you take a look
at adding a tests for it?
diff mbox series

Patch

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index cb0c219ebe1c..33d2221b2bc4 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1721,6 +1721,9 @@  static bool is_interleave_scanning(struct hci_dev *hdev)
 
 static void cancel_interleave_scan(struct hci_dev *hdev)
 {
+	if (!is_interleave_scanning(hdev))
+		return;
+
 	bt_dev_dbg(hdev, "cancelling interleave scan");
 
 	cancel_delayed_work_sync(&hdev->interleave_scan);
@@ -5288,6 +5291,9 @@  int hci_suspend_sync(struct hci_dev *hdev)
 	/* Pause other advertisements */
 	hci_pause_advertising_sync(hdev);
 
+	/* Cancel interleaved scan */
+	cancel_interleave_scan(hdev);
+
 	/* Suspend monitor filters */
 	hci_suspend_monitor_sync(hdev);