Linux bluetooth development
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Hui Wang <hui.wang@canonical.com>,
	linux-bluetooth@vger.kernel.org
Subject: [PATCH 5.12 regression fix] Bluetooth: btusb: Revert Fix the autosuspend enable and disable
Date: Thu, 18 Feb 2021 13:37:28 +0100	[thread overview]
Message-ID: <20210218123728.17067-2-hdegoede@redhat.com> (raw)
In-Reply-To: <20210218123728.17067-1-hdegoede@redhat.com>

drivers/usb/core/hub.c: usb_new_device() contains the following:

        /* By default, forbid autosuspend for all devices.  It will be
         * allowed for hubs during binding.
         */
        usb_disable_autosuspend(udev);

So for anything which is not a hub, such as btusb devices, autosuspend is
disabled by default and we must call usb_enable_autosuspend(udev) to
enable it.

This means that the "Fix the autosuspend enable and disable" commit,
which drops the usb_enable_autosuspend() call when the enable_autosuspend
module option is true, is completely wrong, revert it.

This reverts commit 7bd9fb058d77213130e4b3e594115c028b708e7e.

Cc: Hui Wang <hui.wang@canonical.com>
Fixes: 7bd9fb058d77 ("Bluetooth: btusb: Fix the autosuspend enable and disable")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/bluetooth/btusb.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 54a4f86f32e2..03b83aa91277 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4627,8 +4627,8 @@ static int btusb_probe(struct usb_interface *intf,
 			data->diag = NULL;
 	}
 
-	if (!enable_autosuspend)
-		usb_disable_autosuspend(data->udev);
+	if (enable_autosuspend)
+		usb_enable_autosuspend(data->udev);
 
 	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);
 }
 
 #ifdef CONFIG_PM
-- 
2.30.1


  reply	other threads:[~2021-02-18 14:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 12:37 [PATCH 5.12 regression fix 0/1] Bluetooth: btusb: Revert "Fix the autosuspend enable and disable" Hans de Goede
2021-02-18 12:37 ` Hans de Goede [this message]
2021-02-18 14:36   ` [PATCH 5.12 regression fix] Bluetooth: btusb: Revert Fix the autosuspend enable and disable Hui Wang
2021-02-18 15:02     ` Hans de Goede
2021-02-18 15:43       ` Hui Wang
2021-02-18 20:01       ` Marcel Holtmann
2021-02-18 22:04         ` Hans de Goede
2021-02-18 23:41           ` Luiz Augusto von Dentz
2021-02-19  9:24             ` Hans de Goede
2021-02-25  4:37               ` Hui Wang
2021-02-25 14:17                 ` Hans de Goede
2021-02-26  1:03                   ` Hui Wang
2021-02-18 15:08   ` Bluetooth: btusb: Revert "Fix the autosuspend enable and disable" bluez.test.bot
2021-02-26  1:05   ` [PATCH 5.12 regression fix] Bluetooth: btusb: Revert Fix the autosuspend enable and disable Hui Wang
2021-02-18 13:32 ` [PATCH 5.12 regression fix 0/1] Bluetooth: btusb: Revert "Fix the autosuspend enable and disable" Hui Wang

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=20210218123728.17067-2-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=hui.wang@canonical.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox