RE: reset_resume() for btusb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My thought was to fix the usbcore rebind issue (with pm_runtime)
to let the core unbind and rebind the device's interfaces for drivers 
with no reset_resume callback (not only btusb).
Implementing the btusb reset_resume seems risky,
a patch implementing this callback has been previously reverted due to
HID dual mode device regression. (cf https://lkml.org/lkml/2013/11/26/347)

Regards,
Loic Poulain
________________________________________
From: Oliver Neukum [oneukum@xxxxxxx]
Sent: Wednesday, March 12, 2014 12:03 PM
To: Poulain, Loic
Cc: linux-usb@xxxxxxxxxxxxxxx
Subject: reset_resume() for btusb

Hi,

I still think it makes little sense to support reset_resume()
in btusb, but if you really want to, you can try this patch.

        HTH
                Oliver
>From 3776765dbd08701c30f45c1849691a16c1077cc3 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@xxxxxxx>
Date: Wed, 12 Mar 2014 12:01:13 +0100
Subject: [PATCH] btusb: implement reset_resume()

This implements reset_resume() to the extent that this is possible
for btusb. It can be done if the HCI is down. In the other cases
the host would be thrown out of the network.

Signed-off-by: Oliver Neukum <oneukum@xxxxxxx>
---
 drivers/bluetooth/btusb.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index baeaaed..e56fa2a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1670,6 +1670,25 @@ 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;
+
+       /*
+        * the interface can be recovered only if the HCI
+        * is not part of a network because the synchronization
+        * is lost as the device is reset
+        */
+       if (test_bit(HCI_RUNNING, &hdev->flags))
+               return -EIO;
+
+       if (hdev->setup)
+               return (hdev->setup)(hdev);
+       else
+               return 0;
+}
 #endif

 static struct usb_driver btusb_driver = {
@@ -1679,6 +1698,7 @@ static struct usb_driver btusb_driver = {
 #ifdef CONFIG_PM
        .suspend        = btusb_suspend,
        .resume         = btusb_resume,
+       .reset_resume   = btusb_reset_resume,
 #endif
        .id_table       = btusb_table,
        .supports_autosuspend = 1,
--
1.8.4.5



---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux