]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
Bluetooth: btusb: Fix the autosuspend enable and disable
authorHui Wang <hui.wang@canonical.com>
Wed, 3 Feb 2021 08:02:45 +0000 (16:02 +0800)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 3 Feb 2021 13:34:02 +0000 (14:34 +0100)
commit7bd9fb058d77213130e4b3e594115c028b708e7e
tree04fb8ba8bf87ffae192f2dee3f0a08739d23e658
parentb1810febda94cae09e1095d02fad3be00ce93b6d
Bluetooth: btusb: Fix the autosuspend enable and disable

I tried to disable the autosuspend on btusb through the module
parameter enable_autosuspend, this parameter is set to N, but the usb
bluetooth device is still runtime suspended.
$ cat /sys/module/btusb/parameters/enable_autosuspend
N
$ cat /sys/bus/usb/devices/3-10/power/runtime_status
suspended
$ cat /sys/bus/usb/devices/3-10/power/runtime_suspended_time
65187

We already set ".supports_autosuspend = 1" in the usb_driver, this
device will be set autosuspend enabled by usb core, we don't need
to call usb_enable_autosuspend() in the btusb_probe(). Instead if
users set the parameter enable_autosuspend to N, we need to call
usb_disable_autosuspend() in the btusb_probe(). After this change
and set the parameter to N, we could see the device is not runtime
suspended anymore.
$ cat /sys/module/btusb/parameters/enable_autosuspend
N
$ cat /sys/bus/usb/devices/3-10/power/runtime_status
active
$ cat /sys/bus/usb/devices/3-10/power/runtime_suspended_time
0

And if we disable the autosuspend in the btusb_probe(), we need to
enable the autosuspend in the disconnect(), this could guarantee
that the device could be runtime suspended after we rmmod the btusb.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btusb.c