Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755398AbbFBBcV (ORCPT ); Mon, 1 Jun 2015 21:32:21 -0400 Received: from senator.holtmann.net ([87.106.208.187]:38859 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753825AbbFBBcJ convert rfc822-to-8bit (ORCPT ); Mon, 1 Jun 2015 21:32:09 -0400 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: [PATCH 2/2] Bluetooth: btusb: Add reset_resume function From: Marcel Holtmann In-Reply-To: <1433207682-15064-2-git-send-email-labbott@fedoraproject.org> Date: Tue, 2 Jun 2015 03:32:05 +0200 Cc: Alan Stern , Takashi Iwai , Oliver Neukum , Ming Lei , "David S. Miller" , Johan Hedberg , "Rafael J. Wysocki" , "Gustavo F. Padovan" , linux-bluetooth@vger.kernel.org, Linux Kernel Mailing List , USB list , netdev Content-Transfer-Encoding: 8BIT Message-Id: References: <1433207682-15064-1-git-send-email-labbott@fedoraproject.org> <1433207682-15064-2-git-send-email-labbott@fedoraproject.org> To: Laura Abbott X-Mailer: Apple Mail (2.2098) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1936 Lines: 51 Hi Laura, > Some USB hubs may lose power across suspend/resume. > Add a reset_resume callback to properly reset those bluetoot devices. > > Signed-off-by: Laura Abbott > --- > Now the setup function is called again with the HCI_RESET_RESUME > flag set. The various functions could then use that RESET_RESUME > flag to determine if loading the firmware is appropriate or not. > --- > drivers/bluetooth/btusb.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c > index 3c10d4d..34884cf 100644 > --- a/drivers/bluetooth/btusb.c > +++ b/drivers/bluetooth/btusb.c > @@ -3382,6 +3382,21 @@ done: > > return err; > } > + > +static int btusb_reset_resume(struct usb_interface *intf) > +{ > + struct btusb_data *data = usb_get_intfdata(intf); > + struct hci_dev *hdev = data->hdev; > + int ret; > + > + BT_DBG("intf %p", intf); > + > + ret = btusb_resume(intf); > + if (ret) > + return ret; > + > + return hci_reset_resume_dev(hdev); > +} it seems convenient to call btusb_resume, but I would really prefer if we didn’t. From what I know is that when reset_resume callback is called, then the device has been reset. So that means any prior transfer we have remembered is null and void. So even trying to replay any of it is just a lost cause. Instead we should clear any pending transfers and clear everything and instead pretend that we bring the transport back to its virgin state. It also means that isochronous transfers should be all killed since we will have no SCO connections after this. Remember that we are telling the Bluetooth core to reset this device. Regards Marcel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/