public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Salah Triki <salah.triki@gmail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: bluetooth: get lock before calling usb_[disable|enable]_autosuspend()
Date: Tue, 3 Aug 2021 07:37:57 +0200	[thread overview]
Message-ID: <YQjWNUgFWU2UO0RR@kroah.com> (raw)
In-Reply-To: <20210802221429.GA1370657@pc>

On Mon, Aug 02, 2021 at 11:14:29PM +0100, Salah Triki wrote:
> 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
> 

As was pointed out elsewhere, this is not correct.

thanks,

greg k-h

      reply	other threads:[~2021-08-03  5:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 22:14 [PATCH] usb: bluetooth: get lock before calling usb_[disable|enable]_autosuspend() Salah Triki
2021-08-03  5:37 ` Greg KH [this message]

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=YQjWNUgFWU2UO0RR@kroah.com \
    --to=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 \
    --cc=salah.triki@gmail.com \
    /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