{"id":822,"url":"http://patchwork.ozlabs.org/api/1.0/patches/822/?format=json","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.0/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<1222064651.13064.6.camel@californication>","date":"2008-09-22T06:24:11","name":"btusb suspend/resume bug...","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"08cf425cc516069127f15e62b7291fde8bf25a4c","submitter":{"id":384,"url":"http://patchwork.ozlabs.org/api/1.0/people/384/?format=json","name":"Marcel Holtmann","email":"marcel@holtmann.org"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.0/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1222064651.13064.6.camel@californication/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/822/checks/","tags":{},"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Received":["from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id 6407ADDE11\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 22 Sep 2008 16:23:25 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751714AbYIVGXS (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 02:23:18 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1751664AbYIVGXS\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 02:23:18 -0400","from senator.holtmann.net ([87.106.208.187]:37229 \"EHLO\n\tmail.holtmann.org\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751590AbYIVGXR (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 22 Sep 2008 02:23:17 -0400","from [192.168.1.195] (unknown [12.180.208.198])\n\tby mail.holtmann.org (Postfix) with ESMTP id 07A088B2E5;\n\tMon, 22 Sep 2008 08:23:14 +0200 (CEST)"],"Subject":"Re: btusb suspend/resume bug...","From":"Marcel Holtmann <marcel@holtmann.org>","To":"David Miller <davem@davemloft.net>","Cc":"linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org,\n\t\"Rafael J. Wysocki\" <rjw@sisk.pl>","In-Reply-To":"<1221668269.6782.8.camel@californication>","References":"<20080916.155123.181085856.davem@davemloft.net>\n\t<1221668269.6782.8.camel@californication>","Content-Type":"multipart/mixed; boundary=\"=-NIVSJe9GUQc89e+5JPQt\"","Date":"Mon, 22 Sep 2008 08:24:11 +0200","Message-Id":"<1222064651.13064.6.camel@californication>","Mime-Version":"1.0","X-Mailer":"Evolution 2.22.3.1 ","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Hi Dave,\n\n> > Marcel, others, please bring some kind of closure to this\n> > regression list entry:\n> > \n> > Bug-Entry\t: http://bugzilla.kernel.org/show_bug.cgi?id=11442\n> > Subject\t\t: btusb hibernation/suspend breakage in current -git\n> > Submitter\t: Rafael J. Wysocki <rjw@sisk.pl>\n> > Date\t\t: 2008-08-25 11:37 (19 days old)\n> > References\t: http://marc.info/?l=linux-bluetooth&m=121966402012074&w=4\n> > Handled-By\t: Oliver Neukum <oliver@neukum.org>\n> > Patch\t\t: http://marc.info/?l=linux-bluetooth&m=121967226027323&w=4\n> > \n> > There is a patch, it is tested, so the only course of action at\n> > this point is to merge the fix or declare that this really isn't\n> > a regression.\n> > \n> > My impression is the later, because the driver btusb is replacing\n> > doesn't handle suspend/resume either.  Isn't that right?\n> \n> the original patch that I had was expecting changes in the USB subsystem\n> that I deemed to much at this point. However Oliver got a patch that\n> would make it work without the USB changes. I am still testing it.\n> \n> Let me see if I get some free minutes during the PlumbersConf to get\n> this fully tested.\n\nso I took the patch apart and actually found a few more issues. I am not\nsure if they should be applied this late in -rc phase.\n\nRafael, can you pull from my tree and test the changes:\n\ngit://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6.git\n\nIt would be interesting if these fixes are enough. Or if you need the\nattached suspend/resume patch.\n\nRegards\n\nMarcel","diff":"diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c\nindex 6e455ac..0e9451b 100644\n--- a/drivers/bluetooth/btusb.c\n+++ b/drivers/bluetooth/btusb.c\n@@ -193,6 +193,7 @@ struct btusb_data {\n \tstruct usb_endpoint_descriptor *isoc_rx_ep;\n \n \tint isoc_altsetting;\n+\tint suspend_count;\n };\n \n static void btusb_intr_complete(struct urb *urb)\n@@ -946,10 +947,71 @@ static void btusb_disconnect(struct usb_interface *intf)\n \thci_free_dev(hdev);\n }\n \n+static int btusb_suspend(struct usb_interface *intf, pm_message_t message)\n+{\n+\tstruct btusb_data *data = usb_get_intfdata(intf);\n+\n+\tBT_DBG(\"intf %p\", intf);\n+\n+\tif (data->suspend_count++)\n+\t\treturn 0;\n+\n+\tcancel_work_sync(&data->work);\n+\n+\tusb_kill_anchored_urbs(&data->tx_anchor);\n+\n+\tusb_kill_anchored_urbs(&data->isoc_anchor);\n+\tusb_kill_anchored_urbs(&data->bulk_anchor);\n+\tusb_kill_anchored_urbs(&data->intr_anchor);\n+\n+\treturn 0;\n+}\n+\n+static int btusb_resume(struct usb_interface *intf)\n+{\n+\tstruct btusb_data *data = usb_get_intfdata(intf);\n+\tstruct hci_dev *hdev = data->hdev;\n+\tint err;\n+\n+\tBT_DBG(\"intf %p\", intf);\n+\n+\tif (--data->suspend_count)\n+\t\treturn 0;\n+\n+\tif (!test_bit(HCI_RUNNING, &hdev->flags))\n+\t\treturn 0;\n+\n+\tif (test_bit(BTUSB_INTR_RUNNING, &data->flags)) {\n+\t\terr = btusb_submit_intr_urb(hdev, GFP_NOIO);\n+\t\tif (err < 0) {\n+\t\t\tclear_bit(BTUSB_INTR_RUNNING, &data->flags);\n+\t\t\treturn err;\n+\t\t}\n+\t}\n+\n+\tif (test_bit(BTUSB_BULK_RUNNING, &data->flags)) {\n+\t\tif (btusb_submit_bulk_urb(hdev, GFP_NOIO) < 0)\n+\t\t\tclear_bit(BTUSB_BULK_RUNNING, &data->flags);\n+\t\telse\n+\t\t\tbtusb_submit_bulk_urb(hdev, GFP_NOIO);\n+\t}\n+\n+\tif (test_bit(BTUSB_ISOC_RUNNING, &data->flags)) {\n+\t\tif (btusb_submit_isoc_urb(hdev, GFP_NOIO) < 0)\n+\t\t\tclear_bit(BTUSB_ISOC_RUNNING, &data->flags);\n+\t\telse\n+\t\t\tbtusb_submit_isoc_urb(hdev, GFP_NOIO);\n+\t}\n+\n+\treturn 0;\n+}\n+\n static struct usb_driver btusb_driver = {\n \t.name\t\t= \"btusb\",\n \t.probe\t\t= btusb_probe,\n \t.disconnect\t= btusb_disconnect,\n+\t.suspend\t= btusb_suspend,\n+\t.resume\t\t= btusb_resume,\n \t.id_table\t= btusb_table,\n };\n \n","prefixes":[]}