Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2175066pxy; Mon, 2 Aug 2021 22:39:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWBzi2jRN3QvVzDGq01NdADfk/kbYtp35NPqnBjfjub7kTluMNHOo+ZM4jYOY27omFzkVs X-Received: by 2002:a92:d5cf:: with SMTP id d15mr1332337ilq.194.1627969180648; Mon, 02 Aug 2021 22:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627969180; cv=none; d=google.com; s=arc-20160816; b=T2hrsR1xC0OvGCXTcN2FTDQ6Mtw0wz5Yef6WAu7kBEtff3U/POGialimY68hjlDAAI Nq875JkHuXd7hwoIpaosKMvxK14vYdHc+BPmFKQDbydACJNi3NDoMGraPcDa9TZO3CXE cbt4QAtIKcBYwAgVYfO0dBy7QF/31m2QNBrbzajnWe13mB4NE794MmLN/AVvWbsghuJg iNMYjBekenK+tS8jvkZLo46UGj6P42mmu3jK1I7PcUC2qhdaEOaLbSgBb5nLPLFxCGYT i2RW6L/pTsDziEDXtBRcs1W/ht8q+MaCqBhlalLPjyxAnlMaEhbP2BAqLzeZ9futmsOc OR+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MyE+YXLkr6dPrCxmzCbEimYOU6lGD3w9ey2clVPQtcY=; b=hpGXUdTI/IvARW8unQuMnlhzOEnjxy9guZyebuPX3lRrAGLAceOWebRFm57LlMjOdH O/w3FG0RkYnVE6NnFOqwaQ4YrZwdTPN6JgkMtLwqVzXvEyCnjO7shygac1LXaTQABJ9l MrjlsurEMi9m8XzpC0r/dJcR+CBjZfkk1M1CMy1nEexTJSh3gKvVNRqaJUQkn50n2+LD F3Yn4op+wh8qaKYIw+dg+cTSx4/fEd1n109LU/56yOAfNTn+84+3UzwHrX+3kmVizVqs 1L8Kre4FDuvOS2jeEP2eqN3CTnKLn3fggMCIsDZP6in/4S5lqyl4yN8GDLIvYMThS/Z5 zh8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IeKW5kOx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si14761496ioq.16.2021.08.02.22.39.09; Mon, 02 Aug 2021 22:39:40 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IeKW5kOx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233822AbhHCFiL (ORCPT + 99 others); Tue, 3 Aug 2021 01:38:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:44492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233758AbhHCFiL (ORCPT ); Tue, 3 Aug 2021 01:38:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5027860F48; Tue, 3 Aug 2021 05:37:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627969079; bh=Ltgf7DXL7b3uGZYtty/Mz9MOCbuhMBWzEGcCTBprpBw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IeKW5kOx2QbCoWxjX7jjFg4Xn0+d0LRdsCyvaarNHdM8Aklixj6hj/MMj9mPH40Iz ojU7lfA4k2fi5mFO/wiWCqt1x3ZLOutjzu5R03xi9OWaN7/QB6Av8YibfX/EtTvizL ySWM6F1mVof9wwozdzONcXHZWCxtKEkBq/Cc3OGY= Date: Tue, 3 Aug 2021 07:37:57 +0200 From: Greg KH To: Salah Triki Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: bluetooth: get lock before calling usb_[disable|enable]_autosuspend() Message-ID: References: <20210802221429.GA1370657@pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210802221429.GA1370657@pc> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 > --- > 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