28 lines
907 B
Diff
28 lines
907 B
Diff
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
|
|
index 6ae5aa5..3c5e80f 100644
|
|
--- a/net/bluetooth/hci_core.c
|
|
+++ b/net/bluetooth/hci_core.c
|
|
@@ -2757,7 +2757,8 @@ int hci_register_suspend_notifier(struct hci_dev *hdev)
|
|
{
|
|
int ret = 0;
|
|
|
|
- if (!test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks)) {
|
|
+ if (!hdev->suspend_notifier.notifier_call &&
|
|
+ !test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks)) {
|
|
hdev->suspend_notifier.notifier_call = hci_suspend_notifier;
|
|
ret = register_pm_notifier(&hdev->suspend_notifier);
|
|
}
|
|
@@ -2769,8 +2770,11 @@ int hci_unregister_suspend_notifier(struct hci_dev *hdev)
|
|
{
|
|
int ret = 0;
|
|
|
|
- if (!test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks))
|
|
+ if (hdev->suspend_notifier.notifier_call) {
|
|
ret = unregister_pm_notifier(&hdev->suspend_notifier);
|
|
+ if (!ret)
|
|
+ hdev->suspend_notifier.notifier_call = NULL;
|
|
+ }
|
|
|
|
return ret;
|
|
}
|