Thread (15 messages) flat view 15 messages, 5 authors, 2021-02-26

Re: [PATCH 5.12 regression fix] Bluetooth: btusb: Revert Fix the autosuspend enable and disable

From: Hui Wang <hidden>
Date: 2021-02-18 17:27:20
Subsystem: bluetooth drivers, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

On 2/18/21 8:37 PM, Hans de Goede wrote:
drivers/usb/core/hub.c: usb_new_device() contains the following:
[...]
quoted hunk ↗ jump to hunk
  
  	err = hci_register_dev(hdev);
  	if (err < 0)
@@ -4688,9 +4688,6 @@ static void btusb_disconnect(struct usb_interface *intf)
  		gpiod_put(data->reset_gpio);
  
  	hci_free_dev(hdev);
-
-	if (!enable_autosuspend)
-		usb_enable_autosuspend(data->udev);
Hi Hans,

And Do we need to call usb_disable_autosuspend() in the disconnect()? 
like below:
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 32161dd40ed6..ef831492363c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4673,6 +4673,9 @@ static void btusb_disconnect(struct usb_interface 
*intf)

         hci_unregister_dev(hdev);

+       if (enable_autosuspend)
+               usb_disable_autosuspend(data->udev);
+
         if (intf == data->intf) {
                 if (data->isoc)
usb_driver_release_interface(&btusb_driver, data->isoc);


Before the btusb_probe() is called, the usb device is autosuspend 
disabled, suppose users set the btusb.enable_autosuspend=1, the driver 
btusb will enable the autosuspend on this device. If users remove this 
driver, the disconnect() will be called, the usb device will keep 
autosuspend enabled. Next time if users reload this driver by 'sudo 
modprobe  btusb enalbe_autosuspend=0',  they will find the device is 
autosuspend enabled instead of disabled.

Thanks.

  }
  
  #ifdef CONFIG_PM
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help