From: Salah Triki <salah.triki@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
gregkh@linuxfoundation.org
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] usb: bluetooth: get lock before calling usb_[disable|enable]_autosuspend()
Date: Mon, 2 Aug 2021 23:14:29 +0100 [thread overview]
Message-ID: <20210802221429.GA1370657@pc> (raw)
Based on the documentation of usb_[disable|enable]_autosuspend(), the
caller must hold udev's device lock.
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
drivers/bluetooth/btusb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index a9855a2dd561..2ceb48164b6d 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1939,8 +1939,11 @@ static int btusb_setup_csr(struct hci_dev *hdev)
device_set_wakeup_capable(&data->udev->dev, false);
/* Re-enable autosuspend if this was requested */
- if (enable_autosuspend)
+ if (enable_autosuspend) {
+ usb_lock_device(data->udev);
usb_enable_autosuspend(data->udev);
+ usb_unlock_device(data->udev);
+ }
}
}
--
2.25.1
next reply other threads:[~2021-08-02 22:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 22:14 Salah Triki [this message]
2021-08-03 5:37 ` [PATCH] usb: bluetooth: get lock before calling usb_[disable|enable]_autosuspend() Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210802221429.GA1370657@pc \
--to=salah.triki@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.