[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <A69701BE-FBB3-4053-8187-618C0BD4B380@holtmann.org>
Date: Mon, 31 Aug 2020 17:49:54 +0200
From: Marcel Holtmann <marcel@...tmann.org>
To: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
Cc: linux-bluetooth <linux-bluetooth@...r.kernel.org>,
CrosBT Upstreaming <chromeos-bluetooth-upstreaming@...omium.org>,
"David S. Miller" <davem@...emloft.net>,
Johan Hedberg <johan.hedberg@...il.com>,
netdev <netdev@...r.kernel.org>,
kernel list <linux-kernel@...r.kernel.org>,
Jakub Kicinski <kuba@...nel.org>,
Miao-chen Chou <mcchou@...omium.org>
Subject: Re: [PATCH] Bluetooth: Clear suspend tasks on unregister
Hi Abhishek,
> While unregistering, make sure to clear the suspend tasks before
> cancelling the work. If the unregister is called during resume from
> suspend, this will unnecessarily add 2s to the resume time otherwise.
>
> Fixes: 4e8c36c3b0d73d (Bluetooth: Fix suspend notifier race)
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
> ---
> This was discovered with RT8822CE using the btusb driver. This chipset
> will reset on resume during system suspend and was unnecessarily adding
> 2s to every resume. Since we're unregistering anyway, there's no harm in
> just clearing the pending events.
>
> net/bluetooth/hci_core.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 68bfe57b66250f..ed4cb3479433c0 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -3442,6 +3442,16 @@ void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
> }
> }
>
> +static void hci_suspend_clear_tasks(struct hci_dev *hdev)
> +{
> + int i;
> +
> + for (i = 0; i < __SUSPEND_NUM_TASKS; ++i)
> + clear_bit(i, hdev->suspend_tasks);
I prefer i++ instead of ++i.
Regards
Marcel
Powered by blists - more mailing lists