Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7417015pxb; Thu, 18 Feb 2021 09:30:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwq+tE47khp+8iEzRqxXaeofspOndkZnqzxBKQ7rjShzwU3iSJM8f1JM8rgoBa/Y6o0mQjb X-Received: by 2002:a17:906:855a:: with SMTP id h26mr4851043ejy.430.1613669442127; Thu, 18 Feb 2021 09:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613669442; cv=none; d=google.com; s=arc-20160816; b=XHVj8z4HZQiFinYgdh99MM3HHu7yJZnm8OxK+aTGOYBcBvDU/gJ9uQO1v9UtiXKsBg scDqKoUfKsCExakUNNR65YjdOrPOB7It4cnbeXL5WDyq9qSyR4dS9/IAD3ejVSRRYlSa jgEDHhnR0cOOsJoPy9qJPQiT2s74tRaAfG3Oh4ag2NJniuZ2Yd2jqmrCF+AuLemAR8ut iouCFMp4oKcE084LiXfHdhkB+bpwH1btqNoeTC1dc6vDH+8h9bMYOvVa2Q+WbbUPrJlB obOqfLW1cMrvZ+S1grOjpDHwYDhJtH5VU04v+ImbNUqf5Y00tjIEloujB6a3c2QPDDUT rDcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=G1CS9d5zMy0IQnOlXkTqjU6cuQgWqlOt0Ccfku5Vqc8=; b=t//DBJJa5fS364rtuJGc0kdm9KIXJEMR0bcTcQHFm8GOXYN2SZYJoQ6ZKHUOypjUJT FtgQfNNWdMRmqJx5ICZU0xXTPtg2frRv0CWxeb/T/B6I+MZDFH4rf5HxvQIcDP1NjAA0 5rEGRxd7O2kIfthgmTG60FSJj/pzmbgtzu+fm1nJlT6XFBSOxOWcW1JvdALLQwIQKgK8 iFvTEDQLWDuETB40sEZYe8teXsX/Hbxkd0/ya2uOunf++qco718DlC6AI+iS6bsZ5klS /wH6uX0lWSpzBdM1JK6ucVBIMtZkniodh8vim2vzcSzebhVfkPzsNXnU5pRdGR8rwh/j hmLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc22si4050450edb.233.2021.02.18.09.30.16; Thu, 18 Feb 2021 09:30:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233128AbhBRRZF (ORCPT + 99 others); Thu, 18 Feb 2021 12:25:05 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:36140 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230442AbhBROhZ (ORCPT ); Thu, 18 Feb 2021 09:37:25 -0500 Received: from [123.112.65.49] (helo=[192.168.2.108]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lCkPu-0002mS-Db; Thu, 18 Feb 2021 14:36:30 +0000 Subject: Re: [PATCH 5.12 regression fix] Bluetooth: btusb: Revert Fix the autosuspend enable and disable To: Hans de Goede , Marcel Holtmann , Johan Hedberg Cc: linux-bluetooth@vger.kernel.org References: <20210218123728.17067-1-hdegoede@redhat.com> <20210218123728.17067-2-hdegoede@redhat.com> From: Hui Wang Message-ID: <90d8996d-a376-2e9c-37ce-ce50b8660fd1@canonical.com> Date: Thu, 18 Feb 2021 22:36:07 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20210218123728.17067-2-hdegoede@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On 2/18/21 8:37 PM, Hans de Goede wrote: > drivers/usb/core/hub.c: usb_new_device() contains the following: [...] > > 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